Animator.prototype.start()

The start() method starts the animation. Nothing happens if it is already running.

The state list must already exist in the Animator object's Animator.prototype.props and Animator.prototype.arms.

Syntax

start(speed)

Parameters

speed
A number that represents the index number increment. If you specify something other than a number, it will be 1.
The increment can also be real or negative. For example, if you specify the real number 1.5, the internal index vary like 0, 1.5, 3, 4.5, 6, ..., but truncated values like 0, 1, 3, 4, 6, ... are used to display the graphic elements. This makes it appear to move at 1.5 times its normal speed. A negative value will make the animation appear to play in reverse (if you set the appropriate index with setIndex() beforehand).

Return value

none

Examples

const core = new jmotion.Core("#board");
const animator = new jmotion.Animator(core);

const pl0 = { "x":   0, "y": -30 };
const pl1 = { "x": -30, "y":   0 };
const pl2 = { "x":   0, "y":  30 };
const pl3 = { "x":  30, "y":   0 };

animator.props = [
    {
        "init": [],
        "loop": [ pl0, pl1, pl2, pl3 ],
    }
];
animator.start(0.1);