CanvasAnimation

CanvasAnimation

A helper class providing utility methods for PIXI Canvas animation

Constructor

new CanvasAnimation()

Source:

Members

(static) animations

Source:

Track an object of active animations by name, context, and function This allows a currently playing animation to be referenced and terminated

Methods

(async, static) animateLinear(attributes, context, name, duration, ontick) → {Promise}

Source:

Apply a linear animation from the current value of some attribute to a new value Resolve a Promise once the animation has concluded and the attributes have reached their new target

Example
let animation = [
  {
    parent: token,
    attribute: x,
    to: 1000
  },
  {
    parent: token,
    attribute: y,
    to: 2000
  }
];
CanvasAnimation.animateLinear(attributes, {duration:500, ontick: console.log("ticking")});
Parameters:
Name Type Description
attributes Array.<object>

An array of attributes to animate. Structure of the Array is shown in the example

context Container

An animation context to use which defines scope

name string

Provide a unique animation name which may be referenced later

duration number

The duration in milliseconds over which the animation should occur

ontick function

A function which defines additional behaviors to apply every animation frame

Returns:

A Promise which resolves once the linear animation has concluded

Type
Promise

(static) terminateAnimation(name)

Source:

If an animation using a certain name already exists, terminate it

Parameters:
Name Type Description
name string

The animation name to terminate