Skip to content

Commit d9ecd70

Browse files
committed
Add TimelineBuilderConfig type and callbacks
1 parent 3ebd183 commit d9ecd70

8 files changed

Lines changed: 79 additions & 32 deletions

src/tweens/TweenManager.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ var TweenManager = new Class({
154154
* @method Phaser.Tweens.TweenManager#createTimeline
155155
* @since 3.0.0
156156
*
157-
* @param {object} config - The configuration object for the Timeline and its Tweens.
157+
* @param {Phaser.Types.Tweens.TimelineBuilderConfig} config - The configuration object for the Timeline and its Tweens.
158158
*
159159
* @return {Phaser.Tweens.Timeline} The created Timeline object.
160160
*/
@@ -169,7 +169,7 @@ var TweenManager = new Class({
169169
* @method Phaser.Tweens.TweenManager#timeline
170170
* @since 3.0.0
171171
*
172-
* @param {object} config - The configuration object for the Timeline and its Tweens.
172+
* @param {Phaser.Types.Tweens.TimelineBuilderConfig} config - The configuration object for the Timeline and its Tweens.
173173
*
174174
* @return {Phaser.Tweens.Timeline} The created Timeline object.
175175
*/

src/tweens/builders/TimelineBuilder.js

Lines changed: 1 addition & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -19,40 +19,11 @@ var TweenBuilder = require('./TweenBuilder');
1919
/**
2020
* Builds a Timeline of Tweens based on a configuration object.
2121
*
22-
* The configuration object (`config`) can have the following properties:
23-
*
24-
* `tweens` - an array of tween configuration objects to create and add into the new Timeline, as described by `TweenBuilder`. If this doesn't exist or is empty, the Timeline will start off paused and none of the other configuration settings will be read. If it's a function, it will be called and its return value will be used as the array.
25-
* `targets` - an array (or function which returns one) of default targets to which to apply the Timeline. Each individual Tween configuration can override this value.
26-
* `totalDuration` - if specified, each Tween in the Timeline will get an equal portion of this duration, usually in milliseconds, by default. Each individual Tween configuration can override the Tween's duration.
27-
* `duration` - if `totalDuration` is not specified, the default duration, usually in milliseconds, of each Tween which will be created. Each individual Tween configuration can override the Tween's duration.
28-
* `delay`, `easeParams`, `ease`, `hold`, `repeat`, `repeatDelay`, `yoyo`, `flipX`, `flipY` - the default settings for each Tween which will be created, as specified by `TweenBuilder`. Each individual Tween configuration can override any of these values.
29-
* `completeDelay` - if specified, the time to wait, usually in milliseconds, before the Timeline completes.
30-
* `loop` - how many times the Timeline should loop, or -1 to loop indefinitely.
31-
* `loopDelay` - the time, usually in milliseconds, between each loop
32-
* `paused` - if `true`, the Timeline will start paused
33-
* `useFrames` - if `true`, all duration in the Timeline will be in frames instead of milliseconds
34-
* `callbackScope` - the default scope (`this` value) to use for each callback registered by the Timeline Builder. If not specified, the Timeline itself will be used.
35-
* `onStart` - if specified, the `onStart` callback for the Timeline, called every time it starts playing
36-
* `onStartScope` - the scope (`this` value) to use for the `onStart` callback. If not specified, the `callbackScope` will be used.
37-
* `onStartParams` - additional arguments to pass to the `onStart` callback. The Timeline will always be the first argument.
38-
* `onUpdate` - if specified, the `onUpdate` callback for the Timeline, called every frame it's active, regardless of its Tweens
39-
* `onUpdateScope` - the scope (`this` value) to use for the `onUpdate` callback. If not specified, the `callbackScope` will be used.
40-
* `onUpdateParams` - additional arguments to pass to the `onUpdate` callback. The Timeline will always be the first argument.
41-
* `onLoop` - if specified, the `onLoop` callback for the Timeline, called every time it loops
42-
* `onLoopScope` - the scope (`this` value) to use for the `onLoop` callback. If not specified, the `callbackScope` will be used.
43-
* `onLoopParams` - additional arguments to pass to the `onLoop` callback. The Timeline will always be the first argument.
44-
* `onYoyo` - if specified, the `onYoyo` callback for the Timeline, called every time it yoyos
45-
* `onYoyoScope` - the scope (`this` value) to use for the `onYoyo` callback. If not specified, the `callbackScope` will be used.
46-
* `onYoyoParams` - additional arguments to pass to the `onYoyo` callback. The first argument will always be `null`, while the Timeline will always be the second argument.
47-
* `onComplete` - if specified, the `onComplete` callback for the Timeline, called after it completes
48-
* `onCompleteScope` - the scope (`this` value) to use for the `onComplete` callback. If not specified, the `callbackScope` will be used.
49-
* `onCompleteParams` - additional arguments to pass to the `onComplete` callback. The Timeline will always be the first argument.
50-
*
5122
* @function Phaser.Tweens.Builders.TimelineBuilder
5223
* @since 3.0.0
5324
*
5425
* @param {Phaser.Tweens.TweenManager} manager - The Tween Manager to which the Timeline will belong.
55-
* @param {object} config - The configuration object for the Timeline, as described above.
26+
* @param {Phaser.Types.Tweens.TimelineBuilderConfig} config - The configuration object for the Timeline.
5627
*
5728
* @return {Phaser.Tweens.Timeline} The created Timeline.
5829
*/

src/tweens/typedefs/TimelineBuilderConfig.js

Lines changed: 41 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/**
2+
* @callback Phaser.Types.Tweens.TimelineOnCompleteCallback
3+
* @since 3.18.0
4+
*
5+
* @param {Phaser.Tweens.Timeline} timeline - The timeline.
6+
* @param {...any} param - Any value passed in `onCompleteParams`.
7+
*/
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/**
2+
* @callback Phaser.Types.Tweens.TimelineOnLoopCallback
3+
* @since 3.18.0
4+
*
5+
* @param {Phaser.Tweens.Timeline} timeline - The timeline.
6+
* @param {...any} param - Any value passed in `onLoopParams`.
7+
*/
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/**
2+
* @callback Phaser.Types.Tweens.TimelineOnStartCallback
3+
* @since 3.18.0
4+
*
5+
* @param {Phaser.Tweens.Timeline} timeline - The timeline.
6+
* @param {...any} param - Any value passed in `onStartParams`.
7+
*/
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/**
2+
* @callback Phaser.Types.Tweens.TimelineOnUpdateCallback
3+
* @since 3.18.0
4+
*
5+
* @param {Phaser.Tweens.Timeline} timeline - The timeline.
6+
* @param {...any} param - Any value passed in `onUpdateParams`.
7+
*/
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/**
2+
* @callback Phaser.Types.Tweens.TimelineOnYoyoCallback
3+
* @since 3.18.0
4+
*
5+
* @param {Phaser.Tweens.Timeline} timeline - The timeline.
6+
* @param {...any} param - Any value passed in `onYoyoParams`.
7+
*/

0 commit comments

Comments
 (0)