An open API service indexing awesome lists of open source software.

https://github.com/markbrouch/canvasmark

jQuery plugin for animating a spritesheet on a canvas element
https://github.com/markbrouch/canvasmark

Last synced: about 2 months ago
JSON representation

jQuery plugin for animating a spritesheet on a canvas element

Awesome Lists containing this project

README

          

canvasMark
==========

jQuery plugin for animating a spritesheet on a canvas element

Takes a sprite sheet with frames of equal size positioned left-to-right top-to-bottom order and renders it to a Canvas element.

Usage
=====
Call canvasMark on a canvas tag with additional properties:




$('#myCanvas').canvasMark({
spriteSheet: '/path/to/spritesheet.jpg',
sprite: {
width: 960,
height: 540
},
fps: 30
});

* spriteSheet - The path to the spritesheet resource.
* sprite - Object containing properties width and height of a single sprite on the spritesheet resource.
* fps - Frames per second to playback animation. If unspecified, defaults to 60.

Canvas animation can be controlled via triggers on the canvas element:


$('canvas').trigger('pause'); // Pauses playback
$('canvas').trigger('move', {frames: 5}); // Advances animation 5 frames.

The following triggers are available:
* play
* pause
* next
* prev
* move, {frames: i}