// Create an entity, add the animation component, define
// an animation and then start it
var entity = new IgeEntity()
.addComponent(IgeAnimationComponent)
.animation.define('anim1', [1, 2, 3, 4], 25, -1);
entity.animation.start('anim1');
// Create an entity, add the animation component, define
// an animation and then start it
var entity = new IgeEntity()
.addComponent(IgeAnimationComponent)
.animation.define('anim1', [1, 2, 3, 4], 25, -1);
// In each animation callback...
// this = the entity's animation component instance
// anim = the animation component's _anim object
// this._entity = the entity the animation is attached to
entity.animation.start('anim1', {
onLoop: function (anim) {
console.log('Animation looped', this, anim);
},
onStopped: function (anim) {
console.log('Animation stopped', this, anim);
},
onComplete: function (anim) {
console.log('Animation completed', this, anim);
}
});
// Create an entity, add the animation component, define
// an animation and then start it
var entity = new IgeEntity()
.addComponent(IgeAnimationComponent)
.animation.define('anim1', [1, 2, 3, 4], 25, -1);
// In each animation callback...
// this = the entity's animation component instance
// anim = the animation component's _anim object
// this._entity = the entity the animation is attached to
entity.animation.on('started', function (anim) {
console.log('Animation started', this, anim);
});
entity.animation.on('loopComplete', function (anim) {
console.log('Animation looped', this, anim);
});
entity.animation.on('stopped', function (anim) {
console.log('Animation stopped', this, anim);
});
entity.animation.on('complete', function (anim) {
console.log('Animation complete', this, anim);
});
entity.animation.start('anim1');