javascript - Freezing Gif using JS at last frame -
I am trying to run a GIi animation on my website and I want to freeze it on the last frame. I'm using this code to get it working elsewhere, but it will first go back to the frame or completely disappear. Any help would be greatly appreciated.
& lt; Img src = "http://s12.postimg.org/wq43xqknx/logoani.gif" id = "img1" style = "float: left" /> ATR ('src'))}, 1)}, 1000) And here is jsfiddle: < / Div>
Currently there is no JavaScript, provide an interface to handle frames within an animated GIF, you have to do this for a hack The method must be found ... but
I'm disappointed to use that script See if you want to execute every millisecond CPU Saying, meaning 1000 times per second:
- Element "img1"
- Change its attribute "src" to ....
- ... again
- Read the source for its same node
- Assign the element found in 1
- Then, in the browser cache And find the image
- Depending on the browser, the image can be decoded and sung
Then you can thank God if the browser is still Additional Appropriate some time to work.
In addition, keep in mind about overloading your users' computers, you must meet the exact time to match GIF framerate. And the bad news is that if the framerate is fast, then it is impossible to get it in different browsers or different computers, leave the mobile device alone.
So what can you do? I advise you to play GIF, then replace it with a still image of the final frame. Just calculate how long a recurrence takes, then release an expiration to replace GIF with the still image .
Comments
Post a Comment