Is there a way to create a gif like image with javascript based on some png or jpg?
Just a simple code that change one image for another, creating the impression of a animation, just like a gif.
The idea is to use for generating a banner, so ill upload the pictures (thats done) and i need a code for this animation.
Stackoverflow used this technique for its unicorn animations last april fools day. I preserved the animations on my website. The animation code is my own – I didn’t look at how stackoverflow was doing it.
The concept is to create a sprite, and then change the background position on an interval.
Edit: If you don’t want to create a sprite, here’s an alternate technique you can use. Put all of your animation frame images in a div and hide all but the first one. In your
setIntervalfunction, change which image is diplayed: