Skip to content

Commit 0aba114

Browse files
committed
updated readme
1 parent 3249d74 commit 0aba114

File tree

1 file changed

+19
-44
lines changed

1 file changed

+19
-44
lines changed

README.md

Lines changed: 19 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ _The GIF tag the internet deserves_
1010
<x-gif src="probably_cats.gif"></x-gif>
1111
```
1212

13-
Playback modes:
13+
###Playback modes:
1414

1515
Mutually exclusive. Can't be changed once initialised (create a new x-gif if you want a new mode)
1616

@@ -23,7 +23,7 @@ Defers playback to an external object. The DOM element will then expose a `clock
2323
`bpm="120"`
2424
Syncs GIFs to a given beats-per-minute. If multiple x-gifs are on the page, they will all be synced together. By default, will spread long GIFs over multiple beats, unless the `snap` option is also included. Uses `sync` and `clock` under the hood. Can be changed and will take immediate effect.
2525

26-
Options:
26+
###Options:
2727

2828
`stopped`
2929
Regardless of playback mode, this will prevent the GIF from animating. Removing this attribute resumes playback. In `speed` mode, the GIF will always resume playback from the beginning.
@@ -40,15 +40,15 @@ Instead of allowing longer GIFs to sync to multiple beats, force them to fit int
4040
`ping-pong`
4141
Boolean attribute. Plays the GIF front-to-back then back-to-front, which looks more awesome for some GIFs. Works with all playback modes. Can be removed/added at any time.
4242

43-
Debugging:
43+
###Debugging:
4444

4545
`debug`
4646
Turns on debug output from the Gif Exploder, which can help track down errors with some GIFs being parsed incorrectly.
4747

4848
`exploded`
4949
For visual inspection of the frames. Stops playback, and renders each frame out side-by-side. Many frames will appear semi-transparent, because that's how GIFs work. But this might come in handy.
5050

51-
What does it do?
51+
##What does it do?
5252

5353
* AJAX fetches the GIF as a binary stream
5454
* Slices the GIF into frames like a total boss
@@ -57,52 +57,27 @@ What does it do?
5757

5858
**[Here's a demo! It just might work in your browser!](http://geelen.github.io/x-gif)**
5959

60-
## Options
61-
62-
### Speed
63-
64-
Spins through the frames at its natural rate multiplied by `speed`
65-
66-
```html
67-
<x-gif src="definitely_cats.gif" speed="2.1"></x-gif>
68-
```
69-
70-
### Bpm
71-
72-
Breaks the GIF across 1 or more _beats_ (depending on how long the GIF is), where each beat is 1/`bpm` minutes long.
73-
74-
```html
75-
<x-gif src="something_dumb_from_buzzfeed.gif" bpm="120"></x-gif>
76-
```
77-
78-
### snap-bpm
79-
80-
Just like `bpm` but locks all GIFs to one _beat_, regardless of how long they were originally.
81-
82-
```html
83-
<x-gif src="something_dumb_from_buzzfeed.gif" snap-bpm="120"></x-gif>
84-
```
85-
86-
### Stopped
87-
88-
```html
89-
<x-gif src="something_rad_off_reddit.gif" stopped></x-gif>
90-
```
91-
92-
Stops the `requestAnimationFrame` loop inside the GIF. You can add or remove the `stopped` attribute and it will stop or start. Obvs.
93-
60+
**[Check out the rest of the demos](http://geelen.github.io/x-gif)**
9461

95-
### Sync
62+
## Usage
9663

9764
```html
98-
<x-gif src="mr_t_works_it.gif" sync></x-gif>
65+
<script>
66+
if ('registerElement' in document
67+
&& 'createShadowRoot' in HTMLElement.prototype
68+
&& 'import' in document.createElement('link')
69+
&& 'content' in document.createElement('template')) {
70+
// We're using a browser with native WC support!
71+
} else {
72+
document.write('<script src="https:\/\/cdnjs.cloudflare.com/ajax/libs/polymer/0.3.4/platform.js"><\/script>')
73+
}
74+
</script>
75+
<link rel="import" href="x-gif.html">
9976
```
10077

101-
Defers playback to an external clock, such as beat data from an audio stream to make rad synchronised GIFs & music. [See an example](http://geelen.github.io/x-gif/demos/audio.html).
102-
103-
**[Check out the rest of the demos](http://geelen.github.io/x-gif)**
78+
This will detect support for Web Components, shim them if needed, then load x-gif with a HTML import.
10479

105-
## Status
80+
## Roadmap
10681

10782
* Web Component - YES! (zero-dependencies on Chrome 36!)
10883
* Polymer element - Nah, just use the Web Component

0 commit comments

Comments
 (0)