IgeAnimationComponent

Method: define

Defines an animation specifying the frames to use, the frames per second to animate at and if the animation should loop and if so, how many times.
define (String id, Array frames, Number fps, Number loop, Boolean convertIdsToIndex)
  • Stringid The unique animation id.
  • Arrayframes An array of cell numbers to animate through.
  • Numberfps The speed of the animation (frames per second).
  • Numberloop The number of times to loop the animation, or -1 to loop forever. Defaults to -1.
  • BooleanconvertIdsToIndex If true will convert cell ids to cell indexes to speed up animation processing. This is true by default but should be disabled if you intend to change the assigned texture of the entity that this animation is applied to after you have defined the animation since the frame indexes will likely map to incorrect cells on a different texture.
Returns *

Define an animation

// Create an entity, add the animation component and define
// an animation using frames 1, 2, 3 and 4, with an FPS of
// 25 and looping forever (-1)
var entity = new IgeEntity()
    .addComponent(IgeAnimationComponent)
    .animation.define('anim1', [1, 2, 3, 4], 25, -1);
© Copyright 2013 Irrelon Software Limited. All Rights Reserved. UK Registered Company Number: 07522767
Isogenic (ī´sōjen´ik): Adj originating from a common source; possessing the same genetic composition.
Strange Things Happen at the One Two Point