Giter VIP home page Giter VIP logo

x-gif's Introduction

<x-gif>

The GIF tag the internet deserves

Usage

<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.

<x-gif src="probably_cats.gif"></x-gif>

###Playback modes:

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

speed="1.0" (default mode) Plays back the GIF at its natural framerate multiplied by the value of the attribute. Can be updated and will have immediate effect.

sync Defers playback to an external object. The DOM element will then expose a clock function to facilitate playback. Cannot be changed.

bpm="120" 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.

###Options:

stopped 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.

fill 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 tag.

n-times="3.0" (speed mode only) 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.

snap (sync & bpm modes only) Instead of allowing longer GIFs to sync to multiple beats, force them to fit into only one.

ping-pong 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.

###Debugging:

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

exploded 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.

##What does it do?

  • AJAX fetches the GIF as a binary stream
  • Slices the GIF into frames like a total boss
  • Stacks the frames one on top of the other
  • Starts a requestAnimationFrame loop to play back the gif at its natural frame rate

Here's a demo! It just might work in your browser!

Check out the rest of the demos

Usage

<script>
  if ('registerElement' in document
    && 'createShadowRoot' in HTMLElement.prototype
    && 'import' in document.createElement('link')
    && 'content' in document.createElement('template')) {
    // We're using a browser with native WC support!
  } else {
    document.write('<script src="https:\/\/cdnjs.cloudflare.com/ajax/libs/polymer/0.3.4/platform.js"><\/script>')
  }
</script>
<link rel="import" href="x-gif.html">

This will detect support for Web Components, shim them if needed, then load x-gif with a HTML import.

Roadmap

  • Web Component - YES! (zero-dependencies on Chrome 36!)
  • Polymer element - Nah, just use the Web Component
  • Angular directive - Nah, just use the Web Component
  • React component - Nah, just use the Web Component
  • Ember component - Nah, just use the Web Component

Contributing

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -m 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request :D

License

MIT License

x-gif's People

Contributors

denisnazarov avatar geelen avatar kkirsche avatar soranoba avatar yuchi avatar zenorocha avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

x-gif's Issues

use as polymer element, when polymer's already loaded

I'm trying to use the x-gif polymer element as a thing on its own, but without loading your polymer.js because the site it's getting used on already has polymer loaded. This seems to break everything =(

Is there a way to use the x-gif element as custom element without its own copy of polymer?

Not working in Yosemite Safari (8.0.2)

http://i.imgur.com/mYCOPEg.png

[Warning] platform.js is not the first script on the page. See http://www.polymer-project.org/docs/start/platform.html#setup for details. (platform.js, line 12)
[Error] TypeError: Attempted to assign to readonly property.
(anonymous function) (platform.js, line 16)
(anonymous function) (platform.js, line 16)
global code (platform.js, line 16)
[Warning] Invalid CSS property declaration at: * (foundation.min.css, line 1, x13)
[Error] Error: Attempted to assign to readonly property.
val@http://geelen.github.io/x-gif/demos/angular.min.js:137:424
http://geelen.github.io/x-gif/demos/angular.min.js:138:393
$render@http://geelen.github.io/x-gif/demos/angular.min.js:129:314
http://geelen.github.io/x-gif/demos/angular.min.js:178:431
$digest@http://geelen.github.io/x-gif/demos/angular.min.js:102:245
$apply@http://geelen.github.io/x-gif/demos/angular.min.js:105:180
http://geelen.github.io/x-gif/demos/angular.min.js:18:29
d@http://geelen.github.io/x-gif/demos/angular.min.js:30:525
c@http://geelen.github.io/x-gif/demos/angular.min.js:17:445
Zb@http://geelen.github.io/x-gif/demos/angular.min.js:18:141
Uc@http://geelen.github.io/x-gif/demos/angular.min.js:17:216
http://geelen.github.io/x-gif/demos/angular.min.js:205:217
a@http://geelen.github.io/x-gif/demos/angular.min.js:134:263
http://geelen.github.io/x-gif/demos/angular.min.js:27:212
r@http://geelen.github.io/x-gif/demos/angular.min.js:7:390
c@http://geelen.github.io/x-gif/demos/angular.min.js:27:191
r@https://cdnjs.cloudflare.com/ajax/libs/polymer/0.3.4/platform.js:13:841
p@https://cdnjs.cloudflare.com/ajax/libs/polymer/0.3.4/platform.js:13:174
n@https://cdnjs.cloudflare.com/ajax/libs/polymer/0.3.4/platform.js:12:62290
m@https://cdnjs.cloudflare.com/ajax/libs/polymer/0.3.4/platform.js:12:61868
(anonymous function) (angular.min.js, line 86)
(anonymous function) (angular.min.js, line 63)
$digest (angular.min.js, line 103)
$apply (angular.min.js, line 105)
(anonymous function) (angular.min.js, line 18)
d (angular.min.js, line 30)
c (angular.min.js, line 17)
Zb (angular.min.js, line 18)
Uc (angular.min.js, line 17)
(anonymous function) (angular.min.js, line 205)
a (angular.min.js, line 134)
(anonymous function) (angular.min.js, line 27)
r (angular.min.js, line 7)
c (angular.min.js, line 27)
r (platform.js, line 13)
p (platform.js, line 13)
n (platform.js, line 12)
m (platform.js, line 12)
[Error] Error: Attempted to assign to readonly property.
http://geelen.github.io/x-gif/demos/angular.min.js:57:439
$digest@http://geelen.github.io/x-gif/demos/angular.min.js:102:372
$apply@http://geelen.github.io/x-gif/demos/angular.min.js:105:180
http://geelen.github.io/x-gif/demos/angular.min.js:18:29
d@http://geelen.github.io/x-gif/demos/angular.min.js:30:525
c@http://geelen.github.io/x-gif/demos/angular.min.js:17:445
Zb@http://geelen.github.io/x-gif/demos/angular.min.js:18:141
Uc@http://geelen.github.io/x-gif/demos/angular.min.js:17:216
http://geelen.github.io/x-gif/demos/angular.min.js:205:217
a@http://geelen.github.io/x-gif/demos/angular.min.js:134:263
http://geelen.github.io/x-gif/demos/angular.min.js:27:212
r@http://geelen.github.io/x-gif/demos/angular.min.js:7:390
c@http://geelen.github.io/x-gif/demos/angular.min.js:27:191
r@https://cdnjs.cloudflare.com/ajax/libs/polymer/0.3.4/platform.js:13:841
p@https://cdnjs.cloudflare.com/ajax/libs/polymer/0.3.4/platform.js:13:174
n@https://cdnjs.cloudflare.com/ajax/libs/polymer/0.3.4/platform.js:12:62290
m@https://cdnjs.cloudflare.com/ajax/libs/polymer/0.3.4/platform.js:12:61868
(anonymous function) (angular.min.js, line 86)
(anonymous function) (angular.min.js, line 63)
$digest (angular.min.js, line 103)
$apply (angular.min.js, line 105)
(anonymous function) (angular.min.js, line 18)
d (angular.min.js, line 30)
c (angular.min.js, line 17)
Zb (angular.min.js, line 18)
Uc (angular.min.js, line 17)
(anonymous function) (angular.min.js, line 205)
a (angular.min.js, line 134)
(anonymous function) (angular.min.js, line 27)
r (angular.min.js, line 7)
c (angular.min.js, line 27)
r (platform.js, line 13)
p (platform.js, line 13)
n (platform.js, line 12)
m (platform.js, line 12)
[Error] Error: Attempted to assign to readonly property.
val@http://geelen.github.io/x-gif/demos/angular.min.js:137:424
http://geelen.github.io/x-gif/demos/angular.min.js:138:393
$render@http://geelen.github.io/x-gif/demos/angular.min.js:129:314
http://geelen.github.io/x-gif/demos/angular.min.js:178:431
$digest@http://geelen.github.io/x-gif/demos/angular.min.js:102:245
$apply@http://geelen.github.io/x-gif/demos/angular.min.js:105:180
http://geelen.github.io/x-gif/demos/angular.min.js:18:29
d@http://geelen.github.io/x-gif/demos/angular.min.js:30:525
c@http://geelen.github.io/x-gif/demos/angular.min.js:17:445
Zb@http://geelen.github.io/x-gif/demos/angular.min.js:18:141
Uc@http://geelen.github.io/x-gif/demos/angular.min.js:17:216
http://geelen.github.io/x-gif/demos/angular.min.js:205:217
a@http://geelen.github.io/x-gif/demos/angular.min.js:134:263
http://geelen.github.io/x-gif/demos/angular.min.js:27:212
r@http://geelen.github.io/x-gif/demos/angular.min.js:7:390
c@http://geelen.github.io/x-gif/demos/angular.min.js:27:191
r@https://cdnjs.cloudflare.com/ajax/libs/polymer/0.3.4/platform.js:13:841
p@https://cdnjs.cloudflare.com/ajax/libs/polymer/0.3.4/platform.js:13:174
n@https://cdnjs.cloudflare.com/ajax/libs/polymer/0.3.4/platform.js:12:62290
m@https://cdnjs.cloudflare.com/ajax/libs/polymer/0.3.4/platform.js:12:61868
(anonymous function) (angular.min.js, line 86)
(anonymous function) (angular.min.js, line 63)
$digest (angular.min.js, line 103)
$apply (angular.min.js, line 105)
(anonymous function) (angular.min.js, line 18)
d (angular.min.js, line 30)
c (angular.min.js, line 17)
Zb (angular.min.js, line 18)
Uc (angular.min.js, line 17)
(anonymous function) (angular.min.js, line 205)
a (angular.min.js, line 134)
(anonymous function) (angular.min.js, line 27)
r (angular.min.js, line 7)
c (angular.min.js, line 27)
r (platform.js, line 13)
p (platform.js, line 13)
n (platform.js, line 12)
m (platform.js, line 12)
[Error] Error: Attempted to assign to readonly property.
http://geelen.github.io/x-gif/demos/angular.min.js:57:439
$digest@http://geelen.github.io/x-gif/demos/angular.min.js:102:372
$apply@http://geelen.github.io/x-gif/demos/angular.min.js:105:180
http://geelen.github.io/x-gif/demos/angular.min.js:18:29
d@http://geelen.github.io/x-gif/demos/angular.min.js:30:525
c@http://geelen.github.io/x-gif/demos/angular.min.js:17:445
Zb@http://geelen.github.io/x-gif/demos/angular.min.js:18:141
Uc@http://geelen.github.io/x-gif/demos/angular.min.js:17:216
http://geelen.github.io/x-gif/demos/angular.min.js:205:217
a@http://geelen.github.io/x-gif/demos/angular.min.js:134:263
http://geelen.github.io/x-gif/demos/angular.min.js:27:212
r@http://geelen.github.io/x-gif/demos/angular.min.js:7:390
c@http://geelen.github.io/x-gif/demos/angular.min.js:27:191
r@https://cdnjs.cloudflare.com/ajax/libs/polymer/0.3.4/platform.js:13:841
p@https://cdnjs.cloudflare.com/ajax/libs/polymer/0.3.4/platform.js:13:174
n@https://cdnjs.cloudflare.com/ajax/libs/polymer/0.3.4/platform.js:12:62290
m@https://cdnjs.cloudflare.com/ajax/libs/polymer/0.3.4/platform.js:12:61868
(anonymous function) (angular.min.js, line 86)
(anonymous function) (angular.min.js, line 63)
$digest (angular.min.js, line 103)
$apply (angular.min.js, line 105)
(anonymous function) (angular.min.js, line 18)
d (angular.min.js, line 30)
c (angular.min.js, line 17)
Zb (angular.min.js, line 18)
Uc (angular.min.js, line 17)
(anonymous function) (angular.min.js, line 205)
a (angular.min.js, line 134)
(anonymous function) (angular.min.js, line 27)
r (angular.min.js, line 7)
c (angular.min.js, line 27)
r (platform.js, line 13)
p (platform.js, line 13)
n (platform.js, line 12)
m (platform.js, line 12)
[Error] Error: Attempted to assign to readonly property.
val@http://geelen.github.io/x-gif/demos/angular.min.js:137:424
http://geelen.github.io/x-gif/demos/angular.min.js:138:393
$render@http://geelen.github.io/x-gif/demos/angular.min.js:129:314
http://geelen.github.io/x-gif/demos/angular.min.js:178:431
$digest@http://geelen.github.io/x-gif/demos/angular.min.js:102:245
$apply@http://geelen.github.io/x-gif/demos/angular.min.js:105:180
http://geelen.github.io/x-gif/demos/angular.min.js:18:29
d@http://geelen.github.io/x-gif/demos/angular.min.js:30:525
c@http://geelen.github.io/x-gif/demos/angular.min.js:17:445
Zb@http://geelen.github.io/x-gif/demos/angular.min.js:18:141
Uc@http://geelen.github.io/x-gif/demos/angular.min.js:17:216
http://geelen.github.io/x-gif/demos/angular.min.js:205:217
a@http://geelen.github.io/x-gif/demos/angular.min.js:134:263
http://geelen.github.io/x-gif/demos/angular.min.js:27:212
r@http://geelen.github.io/x-gif/demos/angular.min.js:7:390
c@http://geelen.github.io/x-gif/demos/angular.min.js:27:191
r@https://cdnjs.cloudflare.com/ajax/libs/polymer/0.3.4/platform.js:13:841
p@https://cdnjs.cloudflare.com/ajax/libs/polymer/0.3.4/platform.js:13:174
n@https://cdnjs.cloudflare.com/ajax/libs/polymer/0.3.4/platform.js:12:62290
m@https://cdnjs.cloudflare.com/ajax/libs/polymer/0.3.4/platform.js:12:61868
(anonymous function) (angular.min.js, line 86)
(anonymous function) (angular.min.js, line 63)
$digest (angular.min.js, line 103)
$apply (angular.min.js, line 105)
(anonymous function) (angular.min.js, line 18)
d (angular.min.js, line 30)
c (angular.min.js, line 17)
Zb (angular.min.js, line 18)
Uc (angular.min.js, line 17)
(anonymous function) (angular.min.js, line 205)
a (angular.min.js, line 134)
(anonymous function) (angular.min.js, line 27)
r (angular.min.js, line 7)
c (angular.min.js, line 27)
r (platform.js, line 13)
p (platform.js, line 13)
n (platform.js, line 12)
m (platform.js, line 12)
[Error] Error: Attempted to assign to readonly property.
http://geelen.github.io/x-gif/demos/angular.min.js:57:439
$digest@http://geelen.github.io/x-gif/demos/angular.min.js:102:372
$apply@http://geelen.github.io/x-gif/demos/angular.min.js:105:180
http://geelen.github.io/x-gif/demos/angular.min.js:18:29
d@http://geelen.github.io/x-gif/demos/angular.min.js:30:525
c@http://geelen.github.io/x-gif/demos/angular.min.js:17:445
Zb@http://geelen.github.io/x-gif/demos/angular.min.js:18:141
Uc@http://geelen.github.io/x-gif/demos/angular.min.js:17:216
http://geelen.github.io/x-gif/demos/angular.min.js:205:217
a@http://geelen.github.io/x-gif/demos/angular.min.js:134:263
http://geelen.github.io/x-gif/demos/angular.min.js:27:212
r@http://geelen.github.io/x-gif/demos/angular.min.js:7:390
c@http://geelen.github.io/x-gif/demos/angular.min.js:27:191
r@https://cdnjs.cloudflare.com/ajax/libs/polymer/0.3.4/platform.js:13:841
p@https://cdnjs.cloudflare.com/ajax/libs/polymer/0.3.4/platform.js:13:174
n@https://cdnjs.cloudflare.com/ajax/libs/polymer/0.3.4/platform.js:12:62290
m@https://cdnjs.cloudflare.com/ajax/libs/polymer/0.3.4/platform.js:12:61868
(anonymous function) (angular.min.js, line 86)
(anonymous function) (angular.min.js, line 63)
$digest (angular.min.js, line 103)
$apply (angular.min.js, line 105)
(anonymous function) (angular.min.js, line 18)
d (angular.min.js, line 30)
c (angular.min.js, line 17)
Zb (angular.min.js, line 18)
Uc (angular.min.js, line 17)
(anonymous function) (angular.min.js, line 205)
a (angular.min.js, line 134)
(anonymous function) (angular.min.js, line 27)
r (angular.min.js, line 7)
c (angular.min.js, line 27)
r (platform.js, line 13)
p (platform.js, line 13)
n (platform.js, line 12)
m (platform.js, line 12)
[Error] Error: Attempted to assign to readonly property.
val@http://geelen.github.io/x-gif/demos/angular.min.js:137:424
http://geelen.github.io/x-gif/demos/angular.min.js:138:393
$render@http://geelen.github.io/x-gif/demos/angular.min.js:129:314
http://geelen.github.io/x-gif/demos/angular.min.js:178:431
$digest@http://geelen.github.io/x-gif/demos/angular.min.js:102:245
$apply@http://geelen.github.io/x-gif/demos/angular.min.js:105:180
http://geelen.github.io/x-gif/demos/angular.min.js:18:29
d@http://geelen.github.io/x-gif/demos/angular.min.js:30:525
c@http://geelen.github.io/x-gif/demos/angular.min.js:17:445
Zb@http://geelen.github.io/x-gif/demos/angular.min.js:18:141
Uc@http://geelen.github.io/x-gif/demos/angular.min.js:17:216
http://geelen.github.io/x-gif/demos/angular.min.js:205:217
a@http://geelen.github.io/x-gif/demos/angular.min.js:134:263
http://geelen.github.io/x-gif/demos/angular.min.js:27:212
r@http://geelen.github.io/x-gif/demos/angular.min.js:7:390
c@http://geelen.github.io/x-gif/demos/angular.min.js:27:191
r@https://cdnjs.cloudflare.com/ajax/libs/polymer/0.3.4/platform.js:13:841
p@https://cdnjs.cloudflare.com/ajax/libs/polymer/0.3.4/platform.js:13:174
n@https://cdnjs.cloudflare.com/ajax/libs/polymer/0.3.4/platform.js:12:62290
m@https://cdnjs.cloudflare.com/ajax/libs/polymer/0.3.4/platform.js:12:61868
(anonymous function) (angular.min.js, line 86)
(anonymous function) (angular.min.js, line 63)
$digest (angular.min.js, line 103)
$apply (angular.min.js, line 105)
(anonymous function) (angular.min.js, line 18)
d (angular.min.js, line 30)
c (angular.min.js, line 17)
Zb (angular.min.js, line 18)
Uc (angular.min.js, line 17)
(anonymous function) (angular.min.js, line 205)
a (angular.min.js, line 134)
(anonymous function) (angular.min.js, line 27)
r (angular.min.js, line 7)
c (angular.min.js, line 27)
r (platform.js, line 13)
p (platform.js, line 13)
n (platform.js, line 12)
m (platform.js, line 12)
[Error] Error: Attempted to assign to readonly property.
http://geelen.github.io/x-gif/demos/angular.min.js:57:439
$digest@http://geelen.github.io/x-gif/demos/angular.min.js:102:372
$apply@http://geelen.github.io/x-gif/demos/angular.min.js:105:180
http://geelen.github.io/x-gif/demos/angular.min.js:18:29
d@http://geelen.github.io/x-gif/demos/angular.min.js:30:525
c@http://geelen.github.io/x-gif/demos/angular.min.js:17:445
Zb@http://geelen.github.io/x-gif/demos/angular.min.js:18:141
Uc@http://geelen.github.io/x-gif/demos/angular.min.js:17:216
http://geelen.github.io/x-gif/demos/angular.min.js:205:217
a@http://geelen.github.io/x-gif/demos/angular.min.js:134:263
http://geelen.github.io/x-gif/demos/angular.min.js:27:212
r@http://geelen.github.io/x-gif/demos/angular.min.js:7:390
c@http://geelen.github.io/x-gif/demos/angular.min.js:27:191
r@https://cdnjs.cloudflare.com/ajax/libs/polymer/0.3.4/platform.js:13:841
p@https://cdnjs.cloudflare.com/ajax/libs/polymer/0.3.4/platform.js:13:174
n@https://cdnjs.cloudflare.com/ajax/libs/polymer/0.3.4/platform.js:12:62290
m@https://cdnjs.cloudflare.com/ajax/libs/polymer/0.3.4/platform.js:12:61868
(anonymous function) (angular.min.js, line 86)
(anonymous function) (angular.min.js, line 63)
$digest (angular.min.js, line 103)
$apply (angular.min.js, line 105)
(anonymous function) (angular.min.js, line 18)
d (angular.min.js, line 30)
c (angular.min.js, line 17)
Zb (angular.min.js, line 18)
Uc (angular.min.js, line 17)
(anonymous function) (angular.min.js, line 205)
a (angular.min.js, line 134)
(anonymous function) (angular.min.js, line 27)
r (angular.min.js, line 7)
c (angular.min.js, line 27)
r (platform.js, line 13)
p (platform.js, line 13)
n (platform.js, line 12)
m (platform.js, line 12)
[Error] Failed to load resource: the server responded with a status of 404 (Not Found) (angular.min.js.map, line 0)

play nice with bootstrap

very nice !

what do I need to do to make it play nicely with Bootstrap ?
the position: absolute; css tag makes it a little hard to put it inside bootstrap grid etc.

Detect the end of gif play

Say I load a gif image to play only once. At any given time is it possible to detect if the gif has stopped playing?

Data attribute instead of own tag

Why did you create a new tag (<x-gif>) instead of an data attribute which could be appended to <img> like:

<img src="http://i.imgur.com/Ab4AUEX.jpg" data-x-gif>

or

<img src="http://i.imgur.com/Ab4AUEX.jpg" data-x-gif data-x-gif-speed="2.1"> 

The current solution is not really suitable for valid HTML.

Fix accessibility

The site is spreading front-end development anti-patterns such as IMG tags with no ALT attributes, poor HTML semantics, skipping Hx headings and much more. Please use WAI-ARIA to hide presentational elements from screen readers.

Attached is the output from Fangs:
chrome___fangs_-fangs___x-gif___http___geelen_github_io_x-gif___http___i_imgur_com_ikxh4e2_gif__and__x-gif__and_2014-03-20_1753-_amandaguerriero_s_library

Hello, I am a newBie learning JavaScript here. May I know how to use this?

I try to run the following code:

\\
\\
\\
\\
\\<title>菜鸟教程(runoob.com)</title>
\\
\\
\\<script src="D:\电脑技巧\编程学习\JavaScript\x-gif\x-gif-0.1.1\dist\platform.js"></script>

\\
\\
\\
\\
image

D:\电脑技巧\编程学习\JavaScript\x-gif\x-gif-0.1.1\dist\platform.js is where I found the platform file in the folder that I extracted the latest release.

image

I saw that the gif is 0 * 0 big. Why am I getting this?

Thank you, guys!

Valid unknown application extensions are parsed incorrectly

AFAICT this is not a valid way to skip unknown application extensions:

x-gif/src/exploder.js

Lines 64 to 65 in 085b0c7

streamReader.log("A weird application extension. Skip until we have 2 NULL bytes");
while (!(streamReader.readByte() === 0 && streamReader.peekByte() === 0));

This is because:

  1. Sub-block data of the extension could contain two consecutive zeros.
  2. AFAICT there's no requirement for application extensions to end with 0x00 0x00 (See: http://www.matthewflickinger.com/lab/whatsinagif/bits_and_bytes.asp#plain_text_extension_block. While the NETSCAPE2.0 extension happens to end with 0x00 0x00 only the final 0x00 is considered the block terminator. ). I think the correct approach is to read sub-block sizes and skip each sub-block until the size is 0 (as is done elsewhere).

Self-closing tag

Syntax would be nicer if we use the <x-gif ...> instead of <x-gif ...></x-gif>. Thanks in advance.

Firefox doesn't render gifs properly when fill mode is on

It looks to me like this line is the offending one – this.element.style.webkitTransform should probably be this.element.style.transform, right? If I copy the calculated scale value from Chrome and manually apply it in Firefox it works.

Incidentally, when I've been playing with this (eg. a grid of 8 complex gifs), Firefox miscalculates the scale by around a factor of 10, but only occasionally. This is probably my implementation rather than x-gif itself, but thought it was worth noting.

Scrubber controls

Is it possible to create a scrubbable gif using x-gif?

I could make one externally, but x-gif would need to dispatch an event for when a new frame is shown, and have total frames available as a property. Also would need to be able to set current frame.

Flickering after first animation cycle in Chrome 37

The animation of one of the example gifs (http://i.imgur.com/m25uYzq.gif) on the demonstration page (http://geelen.github.io/x-gif/#/http://i.imgur.com/m25uYzq.gif) starts flickering after its first animation cycle has finished.
It seems as if after each frame a white frame is inserted.

I'm testing this with the current beta version of Chrome on Ubuntu:
Google Chrome: 37.0.2062.20 (Official Build 283104) beta
OS: Linux
Blink: 537.36 (@178111)
JavaScript: V8 3.27.34.6

I don't experience this issue on the current version of Firefox (31.0), so maybe it is a bug inside Chrome.

Let me know if you need further information.

What is being used to Generate the id3 data?

Trying to run the audio.html demo, I've added my own track and am able to get that to load. I was wondering what utility you are using to get the metadata you are loading with lose_yourself_to_dance.json? I found a little tool called exiftool to do my own conversion, but it does not generate an array of "songs".

Thanks! x-gif is fucking awesome!

x-gif is not showing

Hi...
There is a problem !
x-gif is not showing for me... instead of it, the < x-gif > full tag with other attributes is showing...
untitled

I've tried to refresh the page but the problem does not go away...

Any idea what's up with giphy.com?

I was just trying out x-gif and noticed that giphy.com seems to throw a CORS error.

 No 'Access-Control-Allow-Origin' header is present on the requested resource.

Here are the headers for the requested resource:

$ curl -I http://media.giphy.com/media/M5hBbHalNyaHe/giphy.gif

HTTP/1.1 200 OK
Content-Type: image/gif
Content-Length: 1014131
Connection: keep-alive
Date: Mon, 24 Mar 2014 05:01:28 GMT
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: GET
Access-Control-Max-Age: 3000
Last-Modified: Thu, 30 May 2013 05:58:03 GMT
ETag: "55e1a9fb7b6803a1c7b591bd105a0fd5"
Accept-Ranges: bytes
Server: AmazonS3
Age: 781
X-Cache: Hit from cloudfront
Via: 1.1 44604fcb8aac8ad167e49c75f4d97bb0.cloudfront.net (CloudFront)
X-Amz-Cf-Id: Z9-ozHVFWv162dbM1MOFJbfXJYsGiLm1gHu5leaN_jiVOVczhwGH5A==

Access-Control-Allow-Origin is there but maybe there's something else that's missing that I haven't picked up on. Any ideas?

import

how do I import it ???????????????

How can i know gif duration with javascript?

Hello! I want to load several gif, and put the gif speed based in the duration. All gif have to complete the animation sequence in equal time (for example 1 second).
How can i know the gif duration with javascript code in Google chrome?

Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.