Unleash awesomeness. Private packages, team management tools, and powerful integrations. Get started with npm Orgs »

This package has been deprecated

Author message:

This package has been deprecated because it is not performant, and poorly written

e2d-sprite

0.1.4 • Public • Published

e2d-sprite

A simple sprite implementation for e2d.

Usage

var Sprite = require('e2d-sprite');
var r = e2d.Renderer.create(400, 400);
 
var spriteObj = new Sprite('http://domain.com/path/to/sprite/sheet.png');
spriteObj.size.set([16, 16]); //16x16 sprite
spriteObj.frame.set([16, 0]); //draw source Rectangle { x: 16, y: 0, width: 16, height: 16 }
 
//positional information
spriteObj.position.set([200, 200]);//center the sprite on the screen [x, y]
spriteObj.anchor.set([0.5, 0.5]); //anchor in the center
 
 
spriteObj.on('load', function() {
  //sprite is loaded
});
 
r.on('frame', function() {
  spriteObj.rotation += 0.1;
 
  return r.render(
    spriteObj.render()
  );
});
 

Keywords

none

install

npm i e2d-sprite

Downloadsweekly downloads

5

version

0.1.4

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability