@thibka/spritemanager

1.0.0 • Public • Published

spritemanager

Super basic sprite sheet management

Install

NPM

npm i @thibka/spritemanager
import SpriteManager from "@thibka/spritemanager"

ES5

<script src="SpriteManager-es5.js"></script>

Usage

<div id="mySpriteContainer"></div>
#mySpriteContainer {
    width: 370px;
    height: 370px;
    background-position-x: 0;
    background-position-y: 0;
    background-repeat: no-repeat;
    background-image: url(./img/mysprite.png);
    background-size: 370px 3700px;
}
var mySprite = new SpriteManager({
        container: document.getElementById('mySpriteContainer'),
        fps: 25,
        frameHeight: 370,
        height: 3700,
        loop: true,             // Optional.
        loopDelay: 500,         // Optional. Delay between each loop
        beforeLoop: function() {
            // Optional. Triggered before each iteration of a loop
        },
        complete: function() {  
            // Optional. Triggered when animation is done (wheter in a loop or not)
        }
    }); 

mySprite.play();

Readme

Keywords

Package Sidebar

Install

npm i @thibka/spritemanager

Weekly Downloads

0

Version

1.0.0

License

ISC

Unpacked Size

4.49 kB

Total Files

4

Last publish

Collaborators

  • thibka