MCPcopy Create free account
hub / github.com/melonjs/melonJS / setAnimationByIndex

Method setAnimationByIndex

packages/spine-plugin/src/Spine.js:475–485  ·  view source on GitHub ↗

* Sets the current animation for a track by animation index, discarding any queued animations. * @param {number} trackIndex - the track index * @param {number} index - the animation index * @param {boolean} [loop=false] - If true, the animation will repeat. * @returns {TrackEntry} A track en

(trackIndex, index, loop = false)

Source from the content-addressed store, hash-verified

473 * @returns {TrackEntry} A track entry to allow further customization of animation playback.
474 */
475 setAnimationByIndex(trackIndex, index, loop = false) {
476 if (index < 0 || index >= this.skeleton.data.animations.length) {
477 console.warn("Spine plugin: animation index out of range:", index);
478 return undefined;
479 }
480 return this.setAnimation(
481 trackIndex,
482 this.skeleton.data.animations[index].name,
483 loop,
484 );
485 }
486
487 /**
488 * Sets the current animation for a track, discarding any queued animations.

Callers

nothing calls this directly

Calls 1

setAnimationMethod · 0.95

Tested by

no test coverage detected