File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ /**
2+ * @author samme
3+ * @copyright 2020 Photon Storm Ltd.
4+ * @license {@link https://opensource.org/licenses/MIT|MIT License }
5+ */
6+
7+ /**
8+ * The Tween Stop Event.
9+ *
10+ * This event is dispatched by a Tween when it is stopped.
11+ *
12+ * Listen to it from a Tween instance using `Tween.on('stop', listener)`, i.e.:
13+ *
14+ * ```javascript
15+ * var tween = this.tweens.add({
16+ * targets: image,
17+ * x: 500,
18+ * ease: 'Power1',
19+ * duration: 3000
20+ * });
21+ * tween.on('stop', listener);
22+ * ```
23+ *
24+ * @event Phaser.Tweens.Events#TWEEN_STOP
25+ * @since 3.24.0
26+ *
27+ * @param {Phaser.Tweens.Tween } tween - A reference to the Tween instance that emitted the event.
28+ * @param {any[] } targets - An array of references to the target/s the Tween is operating on.
29+ */
30+ module . exports = 'stop' ;
Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ module.exports = {
2121 TWEEN_LOOP : require ( './TWEEN_LOOP_EVENT' ) ,
2222 TWEEN_REPEAT : require ( './TWEEN_REPEAT_EVENT' ) ,
2323 TWEEN_START : require ( './TWEEN_START_EVENT' ) ,
24+ TWEEN_STOP : require ( './TWEEN_STOP_EVENT' ) ,
2425 TWEEN_UPDATE : require ( './TWEEN_UPDATE_EVENT' ) ,
2526 TWEEN_YOYO : require ( './TWEEN_YOYO_EVENT' )
2627
Original file line number Diff line number Diff line change 1515// flipY: flip Y the GameObject on tween end// hold: The time the tween will pause before running a yoyo
1616// hold: The time the tween will pause before running a yoyo
1717// loop: The time the tween will pause before starting either a yoyo or returning to the start for a repeat
18- // loopDelay:
18+ // loopDelay:
1919// offset: Used when the Tween is part of a Timeline
2020// paused: Does the tween start in a paused state, or playing?
2121// props: The properties being tweened by the tween
@@ -53,6 +53,9 @@ module.exports = [
5353 'onStart' ,
5454 'onStartParams' ,
5555 'onStartScope' ,
56+ 'onStop' ,
57+ 'onStopParams' ,
58+ 'onStopScope' ,
5659 'onUpdate' ,
5760 'onUpdateParams' ,
5861 'onUpdateScope' ,
Original file line number Diff line number Diff line change @@ -331,6 +331,7 @@ var Tween = new Class({
331331 onLoop : null ,
332332 onRepeat : null ,
333333 onStart : null ,
334+ onStop : null ,
334335 onUpdate : null ,
335336 onYoyo : null
336337 } ;
@@ -1107,6 +1108,8 @@ var Tween = new Class({
11071108 }
11081109 }
11091110
1111+ this . dispatchTweenEvent ( Events . TWEEN_STOP , this . callbacks . onStop ) ;
1112+
11101113 this . removeAllListeners ( ) ;
11111114
11121115 this . state = TWEEN_CONST . PENDING_REMOVE ;
@@ -1575,6 +1578,7 @@ var Tween = new Class({
15751578
15761579// onActive = 'active' event = When the Tween is moved from the pending to the active list in the manager, even if playback delayed
15771580// onStart = 'start' event = When the Tween starts playing from a delayed state (will happen same time as onActive if no delay)
1581+ // onStop = 'stop' event = When the Tween is stopped
15781582// onYoyo = 'yoyo' event = When the Tween starts a yoyo
15791583// onRepeat = 'repeat' event = When a TweenData repeats playback (if any)
15801584// onComplete = 'complete' event = When the Tween finishes all playback (can sometimes never happen if repeat -1), also when 'stop' called
@@ -1587,6 +1591,7 @@ Tween.TYPES = [
15871591 'onLoop' ,
15881592 'onRepeat' ,
15891593 'onStart' ,
1594+ 'onStop' ,
15901595 'onUpdate' ,
15911596 'onYoyo'
15921597] ;
You can’t perform that action at this time.
0 commit comments