Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/jaforbes/frame
- Owner: JAForbes
- License: mit
- Created: 2014-08-22T11:47:05.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2014-11-15T11:28:02.000Z (almost 10 years ago)
- Last Synced: 2024-04-16T09:06:36.765Z (7 months ago)
- Language: JavaScript
- Size: 164 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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.