mirror of
https://github.com/photonstorm/phaser
synced 2024-11-26 14:40:38 +00:00
TweenData now holds the target index and has a new signature
This commit is contained in:
parent
496ac0f979
commit
58f076a125
5 changed files with 16 additions and 8 deletions
|
@ -36,8 +36,8 @@
|
|||
* The `TIMELINE_LOOP_EVENT` has had the `loopCounter` argument removed from it. It didn't actually send the number of times the Timeline had looped (it actually sent the total remaining).
|
||||
* When a TweenData completes it will now set the `current` property to be exactly either `start` or `end` depending on playback direction.
|
||||
* When a TweenData completes it will set the exact `start` or `end` value into the target property.
|
||||
* `TweenData` has a new optional argument `getActive` which, if given, sets the property value immediately on activation.
|
||||
* `TweenData.getActiveValue` is a new property function that, if not null, returns a value to immediately sets the property value to on activation.
|
||||
* `TweenData` has a new function signature, with the new `index` and `getActive`arguments added to it. `TweenBuilder` has been updated to set these, but if you create any TweenData objects directly, use the new signature.
|
||||
* `TweenData.getActiveValue` is a new property that, if not null, returns a value to immediately sets the property value to on activation.
|
||||
* `GetEaseFunction`, and by extension anything that uses it, such as setting the ease for a Tween, will now accept a variety of input strings as valid. You can now use lower-case, such as `back`, and omit the 'ease' part of the direction, such as `back.in` or `back.inout`.
|
||||
* The signature of `getStart` and `getEnd` custom property functions has changed to `(target, key, value, targetIndex, totalTargets, tween)`, previously it was just `(target, key, value)`. Custom functions don't need to change as the new arguments are in addition to those sent previously.
|
||||
* The signature of the LoadValue generator functions (such as `delay` and `repeat`) has changed to `(target, key, value, targetIndex, totalTargets, tween)` to match those of the custom property functions. If you used a custom generator function for your Tween configs you'll need to modify the signature to the new one. As a result the `
|
||||
|
|
|
@ -63,9 +63,11 @@ var NumberTweenBuilder = function (parent, config, defaults)
|
|||
|
||||
var tweenData = TweenData(
|
||||
targets[0],
|
||||
0,
|
||||
'value',
|
||||
ops.getEnd,
|
||||
ops.getStart,
|
||||
ops.getActive,
|
||||
ease,
|
||||
delay,
|
||||
duration,
|
||||
|
|
|
@ -68,9 +68,11 @@ var TweenBuilder = function (parent, config, defaults)
|
|||
|
||||
var tweenData = TweenData(
|
||||
targets[t],
|
||||
t,
|
||||
key,
|
||||
ops.getEnd,
|
||||
ops.getStart,
|
||||
ops.getActive,
|
||||
GetEaseFunction(GetValue(value, 'ease', ease), easeParams),
|
||||
GetNewValue(value, 'delay', delay),
|
||||
GetNewValue(value, 'duration', duration),
|
||||
|
@ -79,8 +81,7 @@ var TweenBuilder = function (parent, config, defaults)
|
|||
GetNewValue(value, 'repeat', repeat),
|
||||
GetNewValue(value, 'repeatDelay', repeatDelay),
|
||||
GetBoolean(value, 'flipX', flipX),
|
||||
GetBoolean(value, 'flipY', flipY),
|
||||
ops.getActive
|
||||
GetBoolean(value, 'flipY', flipY)
|
||||
);
|
||||
|
||||
data.push(tweenData);
|
||||
|
|
|
@ -14,10 +14,12 @@
|
|||
* @function Phaser.Tweens.TweenData
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param {object} target - The target to tween.
|
||||
* @param {any} target - The target to tween.
|
||||
* @param {integer} index - The target index within the Tween targets array.
|
||||
* @param {string} key - The property of the target to tween.
|
||||
* @param {function} getEnd - What the property will be at the END of the Tween.
|
||||
* @param {function} getStart - What the property will be at the START of the Tween.
|
||||
* @param {?function} getActive - If not null, is invoked _immediately_ as soon as the TweenData is running, and is set on the target property.
|
||||
* @param {function} ease - The ease function this tween uses.
|
||||
* @param {number} delay - Time in ms/frames before tween will start.
|
||||
* @param {number} duration - Duration of the tween in ms/frames.
|
||||
|
@ -27,17 +29,19 @@
|
|||
* @param {number} repeatDelay - Time in ms/frames before the repeat will start.
|
||||
* @param {boolean} flipX - Should toggleFlipX be called when yoyo or repeat happens?
|
||||
* @param {boolean} flipY - Should toggleFlipY be called when yoyo or repeat happens?
|
||||
* @param {?function} [getActive] - If given, is invoked _immediately_ as soon as the TweenData is running, and is set on the target property.
|
||||
*
|
||||
* @return {Phaser.Types.Tweens.TweenDataConfig} The config object describing this TweenData.
|
||||
*/
|
||||
var TweenData = function (target, key, getEnd, getStart, ease, delay, duration, yoyo, hold, repeat, repeatDelay, flipX, flipY, getActive)
|
||||
var TweenData = function (target, index, key, getEnd, getStart, getActive, ease, delay, duration, yoyo, hold, repeat, repeatDelay, flipX, flipY)
|
||||
{
|
||||
return {
|
||||
|
||||
// The target to tween
|
||||
target: target,
|
||||
|
||||
// The index of the target within the tween targets array
|
||||
index: index,
|
||||
|
||||
// The property of the target to tween
|
||||
key: key,
|
||||
|
||||
|
|
|
@ -3,8 +3,9 @@
|
|||
* @since 3.0.0
|
||||
*
|
||||
* @property {any} target - The target to tween.
|
||||
* @property {integer} index - The target index within the Tween targets array.
|
||||
* @property {string} key - The property of the target being tweened.
|
||||
* @property {?Phaser.Types.Tweens.GetActiveCallback} getActiveValue - If set, is invoked _immediately_ as soon as the TweenData is running, and is set on the target property.
|
||||
* @property {?Phaser.Types.Tweens.GetActiveCallback} getActiveValue - If not null, is invoked _immediately_ as soon as the TweenData is running, and is set on the target property.
|
||||
* @property {Phaser.Types.Tweens.GetEndCallback} getEndValue - The returned value sets what the property will be at the END of the Tween.
|
||||
* @property {Phaser.Types.Tweens.GetStartCallback} getStartValue - The returned value sets what the property will be at the START of the Tween.
|
||||
* @property {function} ease - The ease function this tween uses.
|
||||
|
|
Loading…
Reference in a new issue