This is a script that creates an animated image (png or gif/jpg).
Javascript
window.addEvent('domready',function(){
var myAnimation = new AnimateImage('gnome-spinner.png',{
width: 22,
height: 22,
rows: 5,
cols: 7,
fps: 10
});
$(myAnimation).inject($('spinner'));
});
HTML <div id="spinner"></div>Image
var myAnimation = new AnimateImage(url [,options]);
This method will start the animation
This method will stop the animation
This method will stop and restart the animation
This method will return the frame number where the animation is. This value will between 0 and (options.cols * options.rows)
This method will set the animation to a cerain frame.
var myAnimation = new Awf.pngAnimation(url [,options]); myAnimation.setFrame(frame);
This method will set one of the options and reset the animation.
var myAnimation = new Awf.pngAnimation(url [,options]); myAnimation.set(optionKey,value);
This method will set one of the options and reset the animation.
var myAnimation = new Awf.pngAnimation(url [,options]); myAnimation.get(optionKey);
This method will lets you set the speed
var myAnimation = new Awf.pngAnimation(url [,options]); myAnimation.speed(upOrDown[,value]);
You can use this method with the image tag. This method will search for the src tag and will apply the animation
<img src="gnome-spinner.png" id="spinner" />
document.id('spinner').animateImage([options]);
Like Fx.Tween you can use Element.set and Element.get for animateImage. This will only work for the img tag!
<img src="gnome-spinner.png" id="spinner" />
document.id('spinner').set('animateImage',[options]);
Like Fx.Tween you can use Element.set and Element.get for animateImage. This will only work for the img tag!
<img src="gnome-spinner.png" id="spinner" />
document.id('spinner').get('animateImage',[options]);
(object) - AnimateImage instance
You can download this from MooTools Forge
MIT-style license.