Skip to content

Commit b00866c

Browse files
committed
AnimationManager.name will now return the name property of the currently playing animation, if any.
1 parent 08c6106 commit b00866c

3 files changed

Lines changed: 19 additions & 2 deletions

File tree

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,7 @@ Version 2.1.2 - "Whitebridge" - in development
9393
* Cache.getFrameData has a new parameter: `map` which allows you to specify which cache to get the FrameData from, i.e. `Phaser.Cache.IMAGE` or `Phaser.Cache.BITMAPDATA`.
9494
* Sprite.loadTexture if given a BitmapData as the texture will now query the cache to see if it has any associated FrameData, and if so it will load that into the AnimationManager.
9595
* BitmapData.textureLine takes a Phaser.Line object and an image in the image cache. It then accurately draws the image as a repeating texture for the full length of the line.
96-
97-
96+
* AnimationManager.name will now return the `name` property of the currently playing animation, if any.
9897

9998
### Updates
10099

build/phaser.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1159,6 +1159,7 @@ declare module Phaser {
11591159
frameTotal: number;
11601160
game: Phaser.Game;
11611161
isLoaded: boolean;
1162+
name: string;
11621163
paused: boolean;
11631164
sprite: Phaser.Sprite;
11641165
updateIfVisible: boolean;

src/animation/AnimationManager.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -502,6 +502,23 @@ Object.defineProperty(Phaser.AnimationManager.prototype, 'paused', {
502502

503503
});
504504

505+
/**
506+
* @name Phaser.AnimationManager#name
507+
* @property {string} name - Gets the current animation name, if set.
508+
*/
509+
Object.defineProperty(Phaser.AnimationManager.prototype, 'name', {
510+
511+
get: function () {
512+
513+
if (this.currentAnim)
514+
{
515+
return this.currentAnim.name;
516+
}
517+
518+
}
519+
520+
});
521+
505522
/**
506523
* @name Phaser.AnimationManager#frame
507524
* @property {number} frame - Gets or sets the current frame index and updates the Texture Cache for display.

0 commit comments

Comments
 (0)