You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* @param {(string|Phaser.Animations.Animation|Phaser.Types.Animations.PlayAnimationConfig)} key - The string-based key of the animation to play, or an Animation instance, or a `PlayAnimationConfig` object.
482
+
* @param {Phaser.GameObjects.GameObject|Phaser.GameObjects.GameObject[]} children - An array of Game Objects to play the animation on. They must have an Animation Component.
483
+
*
489
484
* @return {this} This Animation Manager.
490
485
*/
491
-
pauseAll: function()
486
+
play: function(key,children)
492
487
{
493
-
if(!this.paused)
488
+
if(!Array.isArray(children))
494
489
{
495
-
this.paused=true;
490
+
children=[children];
491
+
}
496
492
497
-
this.emit(Events.PAUSE_ALL);
493
+
for(vari=0;i<children.length;i++)
494
+
{
495
+
children[i].anims.play(key);
498
496
}
499
497
500
498
returnthis;
501
499
},
502
500
503
501
/**
504
-
* Play an animation on the given Game Objects that have an Animation Component.
502
+
* Takes an array of Game Objects that have an Animation Component and then
503
+
* starts the given animation playing on them. The start time of each Game Object
504
+
* is offset, incrementally, by the `stagger` amount.
505
505
*
506
-
* @method Phaser.Animations.AnimationManager#play
506
+
* For example, if you pass an array with 4 children and a stagger time of 1000,
507
+
* the delays will be:
508
+
*
509
+
* child 1: 1000ms delay
510
+
* child 2: 2000ms delay
511
+
* child 3: 3000ms delay
512
+
* child 4: 4000ms delay
513
+
*
514
+
* If you set the `staggerFirst` parameter to `false` they would be:
515
+
*
516
+
* child 1: 0ms delay
517
+
* child 2: 1000ms delay
518
+
* child 3: 2000ms delay
519
+
* child 4: 3000ms delay
520
+
*
521
+
* You can also set `stagger` to be a negative value. If it was -1000, the above would be:
* @param {string} key - The key of the animation to play on the Game Object.
510
-
* @param {Phaser.GameObjects.GameObject|Phaser.GameObjects.GameObject[]} child - The Game Objects to play the animation on.
531
+
* @generic {Phaser.GameObjects.GameObject[]} G - [items,$return]
532
+
*
533
+
* @param {(string|Phaser.Animations.Animation|Phaser.Types.Animations.PlayAnimationConfig)} key - The string-based key of the animation to play, or an Animation instance, or a `PlayAnimationConfig` object.
534
+
* @param {Phaser.GameObjects.GameObject|Phaser.GameObjects.GameObject[]} children - An array of Game Objects to play the animation on. They must have an Animation Component.
535
+
* @param {number} stagger - The amount of time, in milliseconds, to offset each play time by. If a negative value is given, it's applied to the children in reverse order.
536
+
* @param {boolean} [staggerFirst=true] -Should the first child be staggered as well?
* @generic {Phaser.GameObjects.GameObject[]} G - [items,$return]
594
-
*
595
-
* @param {string} key - The key of the animation to play on the Game Objects.
596
-
* @param {Phaser.GameObjects.GameObject|Phaser.GameObjects.GameObject[]} children - An array of Game Objects to play the animation on. They must have an Animation Component.
597
-
* @param {number} [stagger=0] - The amount of time, in milliseconds, to offset each play time by.
598
-
*
599
-
* @return {this} This Animation Manager.
600
-
*/
601
-
staggerPlay: function(key,children,stagger)
602
-
{
603
-
if(stagger===undefined){stagger=0;}
604
-
605
-
if(!Array.isArray(children))
606
-
{
607
-
children=[children];
608
-
}
609
-
610
-
varanim=this.get(key);
611
-
612
-
if(!anim)
613
-
{
614
-
returnthis;
615
-
}
616
-
617
-
for(vari=0;i<children.length;i++)
618
-
{
619
-
children[i].anims.delayedPlay(stagger*i,key);
620
-
}
621
-
622
-
returnthis;
623
-
},
624
-
625
616
/**
626
617
* Returns the Animation data as JavaScript object based on the given key.
627
618
* Or, if not key is defined, it will return the data of all animations as array of objects.
0 commit comments