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()
start(speed)

Parameters

speed (optional)
A number that represents the index number increment, that will be set to Animator.prototype.speed as is.
For example, if you specify the real number 1.5, the internal index vary like 0, 1.5, 3, 4.5, 6, ..., but only integer part 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 beforehand).
If this argument is omitted, the current value of Animator.prototype.speed will be used.

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);