UNPKG

phaser

Version:

A fast, free and fun HTML5 Game Framework for Desktop and Mobile web browsers.

41 lines (39 loc) 2.03 kB
/** * @author Richard Davey <rich@photonstorm.com> * @copyright 2020 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ /** * The Animation Update Event. * * This event is dispatched by a Sprite when an animation playing on it updates. This happens when the animation changes frame. * An animation will change frame based on the frme rate and other factors like `timeScale` and `delay`. It can also change * frame when stopped or restarted. * * Listen for it on the Sprite using `sprite.on('animationupdate', listener)` * * If an animation is playing faster than the game frame-rate can handle, it's entirely possible for it to emit several * update events in a single game frame, so please be aware of this in your code. The **final** event received that frame * is the one that is rendered to the game. * * The animation event flow is as follows: * * 1. `ANIMATION_START` * 2. `ANIMATION_UPDATE` (repeated for however many frames the animation has) * 3. `ANIMATION_REPEAT` (only if the animation is set to repeat, it then emits more update events after this) * 4. `ANIMATION_COMPLETE` (only if there is a finite, or zero, repeat count) * 5. `ANIMATION_COMPLETE_KEY` (only if there is a finite, or zero, repeat count) * * If the animation is stopped directly, the `ANIMATION_STOP` event is dispatched instead of `ANIMATION_COMPLETE`. * * If the animation is restarted while it is already playing, `ANIMATION_RESTART` is emitted. * * @event Phaser.Animations.Events#ANIMATION_UPDATE * @since 3.50.0 * * @param {Phaser.Animations.Animation} animation - A reference to the Animation that has updated. * @param {Phaser.Animations.AnimationFrame} frame - The current Animation Frame of the Animation. * @param {Phaser.GameObjects.Sprite} gameObject - A reference to the Game Object on which the animation updated. * @param {string} frameKey - The unique key of the Animation Frame within the Animation. */ module.exports = 'animationupdate';