You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+44-16Lines changed: 44 additions & 16 deletions
Original file line number
Diff line number
Diff line change
@@ -6,20 +6,47 @@ _The GIF tag the internet deserves_
6
6
7
7
**<x-gif>** is a web component for flexible GIF playback. Speed them up, slow them down, play them in reverse, synch multiple beats to a rhythm, synch them to audio, whatever you like.
Mutually exclusive. Can't be changed once initialised (create a new x-gif if you want a new mode)
16
+
17
+
`speed="1.0"` (default mode)
18
+
Plays back the GIF at its natural framerate multiplied by the value of the attribute. Can be updated and will have immediate effect.
19
+
20
+
`sync`
21
+
Defers playback to an external object. The DOM element will then expose a `clock` function to facilitate playback. Cannot be changed.
22
+
23
+
`bpm="120"`
24
+
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.
25
+
26
+
Options:
27
+
28
+
`stopped`
29
+
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.
30
+
31
+
`fill`
32
+
Causes the GIF to expand to cover its container, like if you had used `background-size: cover; background-position: 50% 50%` with a normal GIF. Without `fill`, an x-gif behaves like an inline-block element, just like a normal <img> tag.
33
+
34
+
`n-times="3.0"` (speed mode only)
35
+
Stops playback (by adding the attribute `stopped`) after a set number of times. Can be fractional e.g. `0.9` will play the first 90% of the GIF then stop. Removing the `stopped` attribute will restart the playback.
36
+
37
+
`hard` (sync & bpm modes only)
38
+
Instead of allowing longer GIFs to sync to multiple beats, force them to fit into only one.
39
+
40
+
`ping-pong`
41
+
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.
Turns on debug output from the Gif Exploder, which can help track down errors with some GIFs being parsed incorrectly.
18
47
19
-
3. Enjoy limitless GIF possibilities
20
-
```html
21
-
<x-gifsrc="probably_cats.gif"></x-gif>
22
-
```
48
+
`exploded`
49
+
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.
23
50
24
51
What does it do?
25
52
@@ -77,10 +104,11 @@ Defers playback to an external clock, such as beat data from an audio stream to
77
104
78
105
## Status
79
106
80
-
***Polymer element - DONE!**
81
-
* Angular directive - TODO
82
-
* React component - TODO
83
-
* Ember component - TODO
107
+
* Web Component - YES! (zero-dependencies on Chrome 36!)
108
+
* Polymer element - Nah, just use the Web Component
109
+
* Angular directive - Nah, just use the Web Component
110
+
* React component - Nah, just use the Web Component
111
+
* Ember component - Nah, just use the Web Component
0 commit comments