mirror of
https://github.com/photonstorm/phaser
synced 2024-11-22 04:33:31 +00:00
Merge pull request #6930 from samme/major/particle-anims-optional
Make particle animation state optional
This commit is contained in:
commit
37a6dc6f9f
2 changed files with 20 additions and 4 deletions
|
@ -330,11 +330,19 @@ var Particle = new Class({
|
||||||
* It is responsible for playing, loading, queuing animations for later playback,
|
* It is responsible for playing, loading, queuing animations for later playback,
|
||||||
* mixing between animations and setting the current animation frame to this Particle.
|
* mixing between animations and setting the current animation frame to this Particle.
|
||||||
*
|
*
|
||||||
|
* It is created only if the Particle's Emitter has at least one Animation.
|
||||||
|
*
|
||||||
* @name Phaser.GameObjects.Particles.Particle#anims
|
* @name Phaser.GameObjects.Particles.Particle#anims
|
||||||
* @type {Phaser.Animations.AnimationState}
|
* @type {?Phaser.Animations.AnimationState}
|
||||||
* @since 3.60.0
|
* @since 3.60.0
|
||||||
|
* @see Phaser.GameObjects.Particles.ParticleEmitter#setAnim
|
||||||
*/
|
*/
|
||||||
|
this.anims = null;
|
||||||
|
|
||||||
|
if (this.emitter.anims.length > 0)
|
||||||
|
{
|
||||||
this.anims = new AnimationState(this);
|
this.anims = new AnimationState(this);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A rectangle that holds the bounds of this Particle after a call to
|
* A rectangle that holds the bounds of this Particle after a call to
|
||||||
|
@ -590,7 +598,10 @@ var Particle = new Class({
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.anims)
|
||||||
|
{
|
||||||
this.anims.update(0, delta);
|
this.anims.update(0, delta);
|
||||||
|
}
|
||||||
|
|
||||||
var emitter = this.emitter;
|
var emitter = this.emitter;
|
||||||
var ops = emitter.ops;
|
var ops = emitter.ops;
|
||||||
|
@ -782,8 +793,11 @@ var Particle = new Class({
|
||||||
* @since 3.60.0
|
* @since 3.60.0
|
||||||
*/
|
*/
|
||||||
destroy: function ()
|
destroy: function ()
|
||||||
|
{
|
||||||
|
if (this.anims)
|
||||||
{
|
{
|
||||||
this.anims.destroy();
|
this.anims.destroy();
|
||||||
|
}
|
||||||
|
|
||||||
this.anims = null;
|
this.anims = null;
|
||||||
this.emitter = null;
|
this.emitter = null;
|
||||||
|
|
|
@ -1377,6 +1377,8 @@ var ParticleEmitter = new Class({
|
||||||
* anim: [ 'red', 'green', 'blue', 'pink', 'white' ]
|
* anim: [ 'red', 'green', 'blue', 'pink', 'white' ]
|
||||||
* anim: { anims: [ 'red', 'green', 'blue', 'pink', 'white' ], [cycle: bool], [quantity: int] }
|
* anim: { anims: [ 'red', 'green', 'blue', 'pink', 'white' ], [cycle: bool], [quantity: int] }
|
||||||
*
|
*
|
||||||
|
* Call this method at least once before any particles are created, or set `anim` in the Particle Emitter's configuration when creating the Emitter.
|
||||||
|
*
|
||||||
* @method Phaser.GameObjects.Particles.ParticleEmitter#setAnim
|
* @method Phaser.GameObjects.Particles.ParticleEmitter#setAnim
|
||||||
* @since 3.60.0
|
* @since 3.60.0
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in a new issue