Added Tween pause and resume events

This commit is contained in:
Richard Davey 2022-08-09 18:39:09 +01:00
parent b3005513a4
commit 790b4a4341
3 changed files with 64 additions and 0 deletions

View file

@ -0,0 +1,31 @@
/**
* @author Richard Davey <rich@photonstorm.com>
* @copyright 2022 Photon Storm Ltd.
* @license {@link https://opensource.org/licenses/MIT|MIT License}
*/
/**
* The Tween Pause Event.
*
* This event is dispatched by a Tween when it is paused.
*
* Listen to it from a Tween instance using `Tween.on('pause', listener)`, i.e.:
*
* ```javascript
* var timeline = this.tweens.twe({
* targets: image,
* ease: 'Power1',
* duration: 3000,
* tweens: [ { x: 600 }, { y: 500 }, { x: 100 }, { y: 100 } ]
* });
* timeline.on('pause', listener);
* // At some point later ...
* timeline.pause();
* ```
*
* @event Phaser.Tweens.Events#TWEEN_PAUSE
* @since 3.60.0
*
* @param {Phaser.Tweens.Tween} tween - A reference to the Tween instance that emitted the event.
*/
module.exports = 'pause';

View file

@ -0,0 +1,31 @@
/**
* @author Richard Davey <rich@photonstorm.com>
* @copyright 2022 Photon Storm Ltd.
* @license {@link https://opensource.org/licenses/MIT|MIT License}
*/
/**
* The Tween Resume Event.
*
* This event is dispatched by a Tween when it is resumed from a paused state.
*
* Listen to it from a Tween instance using `Tween.on('resume', listener)`, i.e.:
*
* ```javascript
* var timeline = this.tweens.timeline({
* targets: image,
* ease: 'Power1',
* duration: 3000,
* tweens: [ { x: 600 }, { y: 500 }, { x: 100 }, { y: 100 } ]
* });
* timeline.on('resume', listener);
* // At some point later ...
* timeline.resume();
* ```
*
* @event Phaser.Tweens.Events#TWEEN_RESUME
* @since 3.60.0
*
* @param {Phaser.Tweens.Tween} tween - A reference to the Tween instance that emitted the event.
*/
module.exports = 'resume';

View file

@ -19,6 +19,8 @@ module.exports = {
TWEEN_ACTIVE: require('./TWEEN_ACTIVE_EVENT'),
TWEEN_COMPLETE: require('./TWEEN_COMPLETE_EVENT'),
TWEEN_LOOP: require('./TWEEN_LOOP_EVENT'),
TWEEN_PAUSE: require('./TWEEN_PAUSE_EVENT'),
TWEEN_RESUME: require('./TWEEN_RESUME_EVENT'),
TWEEN_REPEAT: require('./TWEEN_REPEAT_EVENT'),
TWEEN_START: require('./TWEEN_START_EVENT'),
TWEEN_STOP: require('./TWEEN_STOP_EVENT'),