🔔 Alert..!! Get 2 Month Free Cloud Hosting With $200 Bonus From Digital Ocean ACTIVATE DEAL

Just another jQuery Spritesheet Animation plugin used to animate a sprite sheet using HTML5 canvas and requestAnimationFrame.

Sprite-Animation

Documentation

#spriteAnimate

  • jQuery plugin for animating a sprite sheet using canvas.
  • Sprite sheet can be linear or a grid of frames.
  • The class loaded gets added to the canvas element after the sprite has loaded. This is useful if you have a large sprite and you want to set a background image on the canvas using the first frame.

##Public Methods ###Play $canvas.spriteAnimate('play'); ###Pause $canvas.spriteAnimate('pause'); ###Go to specified index (zero-based) $canvas.spriteAnimate('goTo', index); ###Get current index (zero-based) $canvas.spriteAnimate('getIndex'); ###Restart sprite (useful when loop is set to false) $canvas.spriteAnimate('restart');

##HTML

<div class="animation-ctn">   <canvas style="width: 460; height: 368;"></canvas> </div> 

##JS

$(function(){   var $canvas = $('canvas');   // init sprite animation 	$canvas.spriteAnimate({ 		frameWidth: 460, 		frameHeight: 368, 		numberOfFrames: 369, 		imgSrc: "/path/to/sprite.png", 		fps: 15, 		loop: true, 		debug: false, 		onFinish: function(){}   }); }); 

You May Also Like