Sprite npm bundle size (scoped) npm

Class : public class Sprite
Inheritance : Sprite > EventDispatcher > Object
Subclasses : ForwardForward, ForwardRewind, SuperSprite

A sprite class designed to easily create/manipulate animated sprite sheets, somewhat based off of AS3’s MovieClip class. This class depends on GreenSock’s TweenLite, which is available at http://greensock.com/. This package is under a MIT license, but TweenLite, which it uses, has it's own licensing agreement, so your usage of this package must adhere to https://greensock.com/licensing/.

It is assumed that the sprite sheet will be laid out left to right, top to bottom. In addition to the layout of the sprite sheet, it is assumed that the element will be provided with a background-image.

{
  background-imgage:url(http://goo.gl/XDwsNz);
}

Installation

npm install --save @danehansen/sprite

Usage

As a module:

import Sprite from '@danehansen/sprite';

var s = new Sprite(document.getElementById('sprite'), 4, 30);

In your browser:

<script src='danehansen-Sprite.min.js'></script>
<script>
  var Sprite = window.danehansen.Sprite;
  var s = new Sprite(document.getElementById('sprite'), 4, 30);
</script>

Public Constants

Public Properties

Public Methods

Events

EXAMPLE

var sprite = new Sprite(document.getElementById('basicSprite'), 4, 30);
>
sprite.progress(0);
>
sprite.frame(0);
>
sprite.progressTo(0);
>
sprite.frameTo(0);
>
sprite.loop(false);