From bfb739b8224e1e575307719872ea3c65fa7a9e6a Mon Sep 17 00:00:00 2001 From: mikebolt Date: Thu, 22 Dec 2016 23:15:26 -0800 Subject: [PATCH] fix: Defer the saving of starting values until '.start()'. --- src/Tween.js | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/src/Tween.js b/src/Tween.js index e1f71629..dcf10e24 100644 --- a/src/Tween.js +++ b/src/Tween.js @@ -124,18 +124,10 @@ TWEEN.Tween = function (object) { this.to = function (properties, duration) { - if (duration !== undefined) { - _duration = duration; - } - _valuesEnd = properties; - // Set all starting values present on the target object - for (var field in _valuesEnd) { - // Only add to updateables if tweenable object has the field - if (typeof _object[field] !== 'undefined') { - _valuesStart[field] = parseFloat(_object[field], 10); - } + if (duration !== undefined) { + _duration = duration; } return this; @@ -173,6 +165,7 @@ TWEEN.Tween = function (object) { continue; } + // Save the starting value. _valuesStart[property] = _object[property]; if ((_valuesStart[property] instanceof Array) === false) {