🚨 Shai-Hulud Strikes Again:834 Packages Compromised.Technical Analysis →
Socket
Book a DemoInstallSign in
Socket

@superherocheesecake/spritesheet

Package Overview
Dependencies
Maintainers
20
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@superherocheesecake/spritesheet

Spritesheet can be used to create a simple spritesheet canvas element.

latest
npmnpm
Version
1.0.4
Version published
Maintainers
20
Created
Source

Spritesheet

Spritesheet can be used to create a simple spritesheet canvas element.

Sprites should be generated with Texturepacker, using the EaselJS template.

Create a spritesheet

const options = {
    devicePixelRatio: devicePixelRatio,
    el: canvas,
    images: [images], // array
    frames: [frames], // array
    order: [data.animations['name'].frames] // optional
};
const spritesheet = new Spritesheet(options);

Methods

frame(int)

Tell Spritesheet which frame to show

spritesheet.frame(0);

Combined with TweenMax (GSAP 2)

TweenMax.fromTo(spritesheet, 1, {frame:0}, {frame:100, roundProps:['frame'], ease:Power0.easeNone});

getCanvas()

If no canvas-element is added to the options, then Spritesheet will create one.

const canvasElement = spritesheet.getCanvas();

close()

Clean up after using it.

spritesheet.close();

FAQs

Package last updated on 01 Sep 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts