Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/jaforbes/frame

A Sprite Sheet Library for Javascript
https://github.com/jaforbes/frame

Last synced: about 1 month ago
JSON representation

A Sprite Sheet Library for Javascript

Awesome Lists containing this project

README

        

Frame
=====

A Sprite Sheet Library for Javascript

Canvas element must be on the page. This will use the first one found.

Note, your spritesheet must be one long strip for frame to automatically figure out how many frames you have.

```javascript
//load your images into native image objects.
var image = $().attr({src:'link to your spritesheet'})[0];

//create your frame object
var frame = new Frame();

//set the frame to use your image, it will figure out how many frames are in your spritesheet automatically.
frame.reset(image);

//draw the next frame, when you run out of frames, draw the first one if repeat is true
frame.next();

//change the play speed to whatever you want
frame._playspeed = 1/3;
```
Best of luck.
Any problems, tweet me.