Skip to content

thibka/spritemanager

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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();

About

Super basic sprite sheet management

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published