Skip to content

Commit f034812

Browse files
committed
Improved docs
1 parent b285b2b commit f034812

1 file changed

Lines changed: 30 additions & 0 deletions

File tree

src/animations/AnimationManager.js

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -683,6 +683,36 @@ var AnimationManager = new Class({
683683
*
684684
* If you're working with a texture atlas, see the `generateFrameNames` method instead.
685685
*
686+
* It's a helper method, designed to make it easier for you to extract frames from sprite sheets.
687+
* If you're working with a texture atlas, see the `generateFrameNames` method instead.
688+
*
689+
* Example:
690+
*
691+
* If you have a sprite sheet loaded called `explosion` and it contains 12 frames, then you can call this method using:
692+
* `this.anims.generateFrameNumbers('explosion', { start: 0, end: 12 })`.
693+
*
694+
* The `end` value tells it to stop after 12 frames. To create an animation using this method, you can do:
695+
*
696+
* ```javascript
697+
* this.anims.create({
698+
* key: 'boom',
699+
* frames: this.anims.generateFrameNames('explosion', {
700+
* start: 0,
701+
* end: 12
702+
* })
703+
* });
704+
* ```
705+
*
706+
* Note that `start` is optional and you don't need to include it if the animation starts from frame 0.
707+
*
708+
* To specify an animation in reverse, swap the `start` and `end` values.
709+
*
710+
* If the frames are not sequential, you may pass an array of frame numbers instead, for example:
711+
*
712+
* `this.anims.generateFrameNumbers('explosion', { frames: [ 0, 1, 2, 1, 2, 3, 4, 0, 1, 2 ] })`
713+
*
714+
* Please see the animation examples and `GenerateFrameNumbers` config docs for further details.
715+
*
686716
* @method Phaser.Animations.AnimationManager#generateFrameNumbers
687717
* @since 3.0.0
688718
*

0 commit comments

Comments
 (0)