Skip to content
This repository was archived by the owner on Jun 23, 2023. It is now read-only.

Commit 03e142a

Browse files
committed
chore(functionTween): breaked tests, but we fixed
fix(check): in-start check for best performance
1 parent 3dad0b5 commit 03e142a

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

rollup.config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { minify } from 'uglify-js-harmony'
55
const { BUILD } = process.env
66

77
const plugins = [ buble({
8-
objectAssign: 'Object.assign'
8+
objectAssign: 'Object.assign'
99
}) ]
1010

1111
let moduleName = 'Tween'

src/dist/Tween.js

+6-4
Original file line numberDiff line numberDiff line change
@@ -233,11 +233,11 @@ class Tween {
233233

234234
this._startTime = _startTime;
235235

236-
for (let property in _valuesEnd) {
236+
if (typeof _valuesEnd === "object") {
237237

238-
property = object[+property] !== undefined ? +property : property;
238+
for (let property in _valuesEnd) {
239239

240-
if (typeof _valuesEnd[property] === "object") {
240+
if (typeof _valuesEnd[property] === "object" && _valuesEnd[property]) {
241241

242242
this._valuesEnd[property] = SubTween(object[property], _valuesEnd[property]);
243243

@@ -269,6 +269,8 @@ class Tween {
269269

270270
}
271271

272+
}
273+
272274
add(this);
273275

274276
this._isPlaying = true;
@@ -452,7 +454,7 @@ class Tween {
452454
if (typeof(end) === 'number') {
453455
object[property] = start + (end - start) * value;
454456
}
455-
} else if (typeof(end) === 'number') {
457+
} else if (typeof(start) === 'number') {
456458
object[property] = start + (end - start) * value;
457459
}
458460

test/unit/tests.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@
216216
var obj = { x: true },
217217
t = new TWEEN.Tween(obj)
218218

219-
t.to({ x: function () {} })
219+
t.to({ x: false })
220220
t.start(0)
221221
t.update(1000)
222222

0 commit comments

Comments
 (0)