Skip to content

Commit

Permalink
Both TweenBuilder and NumberTweenBuilder have been updated to use…
Browse files Browse the repository at this point in the history
… `GetFastValue` for most properties instead of `GetValue`.
  • Loading branch information
photonstorm committed Jan 2, 2025
1 parent 1bcdc87 commit 90d4181
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 30 deletions.
23 changes: 12 additions & 11 deletions src/tweens/builders/NumberTweenBuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ var Defaults = require('../tween/Defaults');
var GetAdvancedValue = require('../../utils/object/GetAdvancedValue');
var GetBoolean = require('./GetBoolean');
var GetEaseFunction = require('./GetEaseFunction');
var GetFastValue = require('../../utils/object/GetFastValue');
var GetNewValue = require('./GetNewValue');
var GetValue = require('../../utils/object/GetValue');
var GetValueOp = require('./GetValueOp');
Expand Down Expand Up @@ -55,16 +56,16 @@ var NumberTweenBuilder = function (parent, config, defaults)
//
// tween.getValue()

var from = GetValue(config, 'from', 0);
var to = GetValue(config, 'to', 1);
var from = GetFastValue(config, 'from', 0);
var to = GetFastValue(config, 'to', 1);

var targets = [ { value: from } ];

var delay = GetValue(config, 'delay', defaults.delay);
var easeParams = GetValue(config, 'easeParams', defaults.easeParams);
var ease = GetValue(config, 'ease', defaults.ease);
var delay = GetFastValue(config, 'delay', defaults.delay);
var easeParams = GetFastValue(config, 'easeParams', defaults.easeParams);
var ease = GetFastValue(config, 'ease', defaults.ease);

var ops = GetValueOp('value', to);
var ops = GetFastValueOp('value', to);

var tween = new Tween(parent, targets);

Expand All @@ -74,13 +75,13 @@ var NumberTweenBuilder = function (parent, config, defaults)
ops.getEnd,
ops.getStart,
ops.getActive,
GetEaseFunction(GetValue(config, 'ease', ease), GetValue(config, 'easeParams', easeParams)),
GetEaseFunction(GetFastValue(config, 'ease', ease), GetFastValue(config, 'easeParams', easeParams)),
GetNewValue(config, 'delay', delay),
GetValue(config, 'duration', defaults.duration),
GetFastValue(config, 'duration', defaults.duration),
GetBoolean(config, 'yoyo', defaults.yoyo),
GetValue(config, 'hold', defaults.hold),
GetValue(config, 'repeat', defaults.repeat),
GetValue(config, 'repeatDelay', defaults.repeatDelay),
GetFastValue(config, 'hold', defaults.hold),
GetFastValue(config, 'repeat', defaults.repeat),
GetFastValue(config, 'repeatDelay', defaults.repeatDelay),
false,
false
);
Expand Down
39 changes: 20 additions & 19 deletions src/tweens/builders/TweenBuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ var Defaults = require('../tween/Defaults');
var GetAdvancedValue = require('../../utils/object/GetAdvancedValue');
var GetBoolean = require('./GetBoolean');
var GetEaseFunction = require('./GetEaseFunction');
var GetFastValue = require('../../utils/object/GetFastValue');
var GetInterpolationFunction = require('./GetInterpolationFunction');
var GetNewValue = require('./GetNewValue');
var GetProps = require('./GetProps');
Expand Down Expand Up @@ -60,17 +61,17 @@ var TweenBuilder = function (parent, config, defaults)

// Default Tween values

var delay = GetValue(config, 'delay', defaults.delay);
var duration = GetValue(config, 'duration', defaults.duration);
var easeParams = GetValue(config, 'easeParams', defaults.easeParams);
var ease = GetValue(config, 'ease', defaults.ease);
var hold = GetValue(config, 'hold', defaults.hold);
var repeat = GetValue(config, 'repeat', defaults.repeat);
var repeatDelay = GetValue(config, 'repeatDelay', defaults.repeatDelay);
var delay = GetFastValue(config, 'delay', defaults.delay);
var duration = GetFastValue(config, 'duration', defaults.duration);
var easeParams = GetFastValue(config, 'easeParams', defaults.easeParams);
var ease = GetFastValue(config, 'ease', defaults.ease);
var hold = GetFastValue(config, 'hold', defaults.hold);
var repeat = GetFastValue(config, 'repeat', defaults.repeat);
var repeatDelay = GetFastValue(config, 'repeatDelay', defaults.repeatDelay);
var yoyo = GetBoolean(config, 'yoyo', defaults.yoyo);
var flipX = GetBoolean(config, 'flipX', defaults.flipX);
var flipY = GetBoolean(config, 'flipY', defaults.flipY);
var interpolation = GetValue(config, 'interpolation', defaults.interpolation);
var interpolation = GetFastValue(config, 'interpolation', defaults.interpolation);

var addTarget = function (tween, targetIndex, key, value)
{
Expand Down Expand Up @@ -108,10 +109,10 @@ var TweenBuilder = function (parent, config, defaults)
texture,
frame,
GetNewValue(value, 'delay', delay),
GetValue(value, 'duration', duration),
GetValue(value, 'hold', hold),
GetValue(value, 'repeat', repeat),
GetValue(value, 'repeatDelay', repeatDelay),
GetFastValue(value, 'duration', duration),
GetFastValue(value, 'hold', hold),
GetFastValue(value, 'repeat', repeat),
GetFastValue(value, 'repeatDelay', repeatDelay),
GetBoolean(value, 'flipX', flipX),
GetBoolean(value, 'flipY', flipY)
);
Expand All @@ -120,21 +121,21 @@ var TweenBuilder = function (parent, config, defaults)
{
var ops = GetValueOp(key, value);

var interpolationFunc = GetInterpolationFunction(GetValue(value, 'interpolation', interpolation));
var interpolationFunc = GetInterpolationFunction(GetFastValue(value, 'interpolation', interpolation));

tween.add(
targetIndex,
key,
ops.getEnd,
ops.getStart,
ops.getActive,
GetEaseFunction(GetValue(value, 'ease', ease), GetValue(value, 'easeParams', easeParams)),
GetEaseFunction(GetFastValue(value, 'ease', ease), GetFastValue(value, 'easeParams', easeParams)),
GetNewValue(value, 'delay', delay),
GetValue(value, 'duration', duration),
GetFastValue(value, 'duration', duration),
GetBoolean(value, 'yoyo', yoyo),
GetValue(value, 'hold', hold),
GetValue(value, 'repeat', repeat),
GetValue(value, 'repeatDelay', repeatDelay),
GetFastValue(value, 'hold', hold),
GetFastValue(value, 'repeat', repeat),
GetFastValue(value, 'repeatDelay', repeatDelay),
GetBoolean(value, 'flipX', flipX),
GetBoolean(value, 'flipY', flipY),
interpolationFunc,
Expand Down Expand Up @@ -174,7 +175,7 @@ var TweenBuilder = function (parent, config, defaults)
tween.persist = GetBoolean(config, 'persist', false);

// Set the Callbacks
tween.callbackScope = GetValue(config, 'callbackScope', tween);
tween.callbackScope = GetFastValue(config, 'callbackScope', tween);

var callbacks = BaseTween.TYPES;

Expand Down

0 comments on commit 90d4181

Please sign in to comment.