Animator.prototype.setIndex()

The setIndex() method sets the animation index number. In addition, each graphic element is drawn in its current state.

The index number is 0 when the Animator object is created and automatically increases as the animation progresses. The index number never decreases or returns to 0 unless you use this method.

Syntax

setIndex(index)

Parameters

index
A number greater than or equal to 0. If you specify a value less than 0 or a non-numeric value, the index number will be 0.

Return value

none

Examples

const core = new jmotion.Core("#board");
const animator = new jmotion.Animator(core);
const before = animator.getIndex();
animator.setIndex(10);
const after = animator.getIndex();

// before = 0
// after = 10