Skip to content

Commit c89fac2

Browse files
committed
Adding new Tween events
1 parent da50dd5 commit c89fac2

4 files changed

Lines changed: 91 additions & 1 deletion

File tree

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/**
2+
* @author Richard Davey <rich@photonstorm.com>
3+
* @copyright 2019 Photon Storm Ltd.
4+
* @license {@link https://opensource.org/licenses/MIT|MIT License}
5+
*/
6+
7+
/**
8+
* The Tween Active Event.
9+
*
10+
* This event is dispatched by a Tween when it becomes active within the Tween Manager.
11+
*
12+
* Listen to it from a Tween instance using `Tween.on('active', listener)`, i.e.:
13+
*
14+
* ```javascript
15+
* var tween = this.tweens.add({
16+
* targets: image,
17+
* ease: 'Power1',
18+
* duration: 3000,
19+
* tweens: [ { x: 600 }, { y: 500 }, { x: 100 }, { y: 100 } ]
20+
* });
21+
* tween.on('active', listener);
22+
* ```
23+
*
24+
* @event Phaser.Tweens.Events#TWEEN_ACTIVE
25+
* @since 3.19.0
26+
*
27+
* @param {Phaser.Tweens.Tween} tween - A reference to the Tween instance that emitted the event.
28+
*/
29+
module.exports = 'active';
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/**
2+
* @author Richard Davey <rich@photonstorm.com>
3+
* @copyright 2019 Photon Storm Ltd.
4+
* @license {@link https://opensource.org/licenses/MIT|MIT License}
5+
*/
6+
7+
/**
8+
* The Tween Complete Event.
9+
*
10+
* This event is dispatched by a Tween when it completes playback.
11+
*
12+
* Listen to it from a Tween instance using `Tween.on('complete', listener)`, i.e.:
13+
*
14+
* ```javascript
15+
* var tween = this.tweens.add({
16+
* targets: image,
17+
* ease: 'Power1',
18+
* duration: 3000,
19+
* tweens: [ { x: 600 }, { y: 500 }, { x: 100 }, { y: 100 } ]
20+
* });
21+
* tween.on('complete', listener);
22+
* ```
23+
*
24+
* @event Phaser.Tweens.Events#TWEEN_COMPLETE
25+
* @since 3.19.0
26+
*
27+
* @param {Phaser.Tweens.Tween} tween - A reference to the Tween instance that emitted the event.
28+
*/
29+
module.exports = 'complete';
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/**
2+
* @author Richard Davey <rich@photonstorm.com>
3+
* @copyright 2019 Photon Storm Ltd.
4+
* @license {@link https://opensource.org/licenses/MIT|MIT License}
5+
*/
6+
7+
/**
8+
* The Tween Start Event.
9+
*
10+
* This event is dispatched by a Tween when it starts playback.
11+
*
12+
* Listen to it from a Tween instance using `Tween.on('start', listener)`, i.e.:
13+
*
14+
* ```javascript
15+
* var tween = this.tweens.add({
16+
* targets: image,
17+
* ease: 'Power1',
18+
* duration: 3000,
19+
* tweens: [ { x: 600 }, { y: 500 }, { x: 100 }, { y: 100 } ]
20+
* });
21+
* tween.on('start', listener);
22+
* ```
23+
*
24+
* @event Phaser.Tweens.Events#TWEEN_START
25+
* @since 3.19.0
26+
*
27+
* @param {Phaser.Tweens.Tween} tween - A reference to the Tween instance that emitted the event.
28+
*/
29+
module.exports = 'start';

src/tweens/events/index.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ module.exports = {
1515
TIMELINE_PAUSE: require('./TIMELINE_PAUSE_EVENT'),
1616
TIMELINE_RESUME: require('./TIMELINE_RESUME_EVENT'),
1717
TIMELINE_START: require('./TIMELINE_START_EVENT'),
18-
TIMELINE_UPDATE: require('./TIMELINE_UPDATE_EVENT')
18+
TIMELINE_UPDATE: require('./TIMELINE_UPDATE_EVENT'),
19+
TWEEN_ACTIVE: require('./TWEEN_ACTIVE_EVENT'),
20+
TWEEN_COMPLETE: require('./TWEEN_COMPLETE_EVENT'),
21+
TWEEN_START: require('./TWEEN_START_EVENT')
1922

2023
};

0 commit comments

Comments
 (0)