mirror of
https://github.com/photonstorm/phaser
synced 2024-11-10 07:04:31 +00:00
Merge pull request #5159 from tgroborsch/feature/multi-anims-chain
Allow chaining of multible animations
This commit is contained in:
commit
8951211c74
1 changed files with 15 additions and 2 deletions
|
@ -87,6 +87,15 @@ var Animation = new Class({
|
|||
*/
|
||||
this.nextAnim = null;
|
||||
|
||||
/**
|
||||
* A queue of keys of the next Animations to be loaded into this Animation Controller when the current animation completes.
|
||||
*
|
||||
* @name Phaser.GameObjects.Components.Animation#nextAnimsQueue
|
||||
* @type {Array}
|
||||
* @default []
|
||||
*/
|
||||
this.nextAnimsQueue = [];
|
||||
|
||||
/**
|
||||
* Time scale factor.
|
||||
*
|
||||
|
@ -321,7 +330,11 @@ var Animation = new Class({
|
|||
key = key.key;
|
||||
}
|
||||
|
||||
this.nextAnim = key;
|
||||
if(this.nextAnim === null){
|
||||
this.nextAnim = key;
|
||||
} else {
|
||||
this.nextAnimsQueue.push(key);
|
||||
}
|
||||
|
||||
return this.parent;
|
||||
},
|
||||
|
@ -850,7 +863,7 @@ var Animation = new Class({
|
|||
{
|
||||
var key = this.nextAnim;
|
||||
|
||||
this.nextAnim = null;
|
||||
this.nextAnim = this.nextAnimsQueue.length > 0 ? this.nextAnimsQueue.shift() : null;
|
||||
|
||||
this.play(key);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue