Skip to content

Commit 5a255ec

Browse files
committed
Fixed Tween Event defs. Fix phaserjs#4666
1 parent da2e96b commit 5a255ec

4 files changed

Lines changed: 39 additions & 5 deletions

File tree

src/tweens/Timeline.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ var Timeline = new Class({
274274
* @method Phaser.Tweens.Timeline#dispatchTimelineEvent
275275
* @since 3.19.0
276276
*
277-
* @param {Phaser.Tweens.Events} event - The Event to be dispatched.
277+
* @param {Phaser.Types.Tweens.Event} event - The Event to be dispatched.
278278
* @param {function} callback - The callback to be invoked. Can be `null` or `undefined` to skip invocation.
279279
*/
280280
dispatchTimelineEvent: function (event, callback)

src/tweens/TweenManager.js

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -265,12 +265,42 @@ var TweenManager = new Class({
265265
},
266266

267267
/**
268-
* Creates a stagger function and returns it.
268+
* Creates a Stagger function to be used by a Tween property.
269+
*
270+
* The stagger function will allow you to stagger changes to the value of the property across all targets of the tween.
271+
*
272+
* This is only worth using if the tween has multiple targets.
273+
*
274+
* The following will stagger the delay by 100ms across all targets of the tween, causing them to scale down to 0.2
275+
* over the duration specified:
276+
*
277+
* ```javascript
278+
* this.tweens.add({
279+
* targets: [ ... ],
280+
* scale: 0.2,
281+
* ease: 'linear',
282+
* duration: 1000,
283+
* delay: this.tweens.stagger(100)
284+
* });
285+
* ```
286+
*
287+
* The following will stagger the delay by 500ms across all targets of the tween using a 10 x 6 grid, staggering
288+
* from the center out, using a cubic ease.
289+
*
290+
* ```javascript
291+
* this.tweens.add({
292+
* targets: [ ... ],
293+
* scale: 0.2,
294+
* ease: 'linear',
295+
* duration: 1000,
296+
* delay: this.tweens.stagger(500, { grid: [ 10, 6 ], from: 'center', ease: 'cubic.out' })
297+
* });
298+
* ```
269299
*
270300
* @method Phaser.Tweens.TweenManager#stagger
271301
* @since 3.19.0
272302
*
273-
* @param {Phaser.Types.Tweens.StaggerBuilderConfig} config - The configuration object for the Stagger function.
303+
* @param {Phaser.Types.Tweens.StaggerConfig} config - The configuration object for the Stagger function.
274304
*
275305
* @return {function} The stagger function.
276306
*/

src/tweens/tween/Tween.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1228,7 +1228,7 @@ var Tween = new Class({
12281228
* @method Phaser.Tweens.Tween#dispatchTweenDataEvent
12291229
* @since 3.19.0
12301230
*
1231-
* @param {Phaser.Tweens.Events} event - The Event to be dispatched.
1231+
* @param {Phaser.Types.Tweens.Event} event - The Event to be dispatched.
12321232
* @param {function} callback - The callback to be invoked. Can be `null` or `undefined` to skip invocation.
12331233
* @param {Phaser.Types.Tweens.TweenDataConfig} tweenData - The TweenData object that caused this event.
12341234
*/
@@ -1253,7 +1253,7 @@ var Tween = new Class({
12531253
* @method Phaser.Tweens.Tween#dispatchTweenEvent
12541254
* @since 3.19.0
12551255
*
1256-
* @param {Phaser.Tweens.Events} event - The Event to be dispatched.
1256+
* @param {Phaser.Types.Tweens.Event} event - The Event to be dispatched.
12571257
* @param {function} callback - The callback to be invoked. Can be `null` or `undefined` to skip invocation.
12581258
*/
12591259
dispatchTweenEvent: function (event, callback)

src/tweens/typedefs/Event.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/**
2+
* @typedef {string} Phaser.Types.Tweens.Event - A Tween Event.
3+
* @since 3.19.0
4+
*/

0 commit comments

Comments
 (0)