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

Commit

Permalink
performance boost
Browse files Browse the repository at this point in the history
  • Loading branch information
dalisoft committed May 17, 2019
1 parent fdc4ac8 commit 9a54071
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 39 deletions.
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"eslint.enable": true,
"eslint.autoFixOnSave": true,
"eslint.packageManager": "npm",
"prettier.requireConfig": true
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "es6-tween",
"version": "5.5.9",
"version": "5.5.10",
"description": "ES6 implementation of amazing tween.js",
"browser": "bundled/Tween.min.js",
"cdn": "bundled/Tween.min.js",
Expand Down
79 changes: 41 additions & 38 deletions src/Tween.js
Original file line number Diff line number Diff line change
Expand Up @@ -402,52 +402,55 @@ class Tween {
_valuesEnd = this._valuesEnd = InitialValues(node, object)
}
}
for (const property in _valuesEnd) {
let start = object && object[property] && deepCopy(object[property])
let end = _valuesEnd[property]
if (Plugins[property] && Plugins[property].init) {
Plugins[property].init.call(this, start, end, property, object)
if (start === undefined && _valuesStart[property]) {
start = _valuesStart[property]
if (!_valuesStart.processed) {
for (const property in _valuesEnd) {
let start = object && object[property] && deepCopy(object[property])
let end = _valuesEnd[property]
if (Plugins[property] && Plugins[property].init) {
Plugins[property].init.call(this, start, end, property, object)
if (start === undefined && _valuesStart[property]) {
start = _valuesStart[property]
}
if (Plugins[property].skipProcess) {
continue
}
}
if (Plugins[property].skipProcess) {
if (
(typeof start === 'number' && isNaN(start)) ||
start === null ||
end === null ||
start === false ||
end === false ||
start === undefined ||
end === undefined ||
start === end
) {
continue
}
}
if (
(typeof start === 'number' && isNaN(start)) ||
start === null ||
end === null ||
start === false ||
end === false ||
start === undefined ||
end === undefined ||
start === end
) {
continue
}
_valuesStart[property] = start
if (Array.isArray(end)) {
if (!Array.isArray(start)) {
end.unshift(start)
for (let i = 0, len = end.length; i < len; i++) {
if (typeof end[i] === 'string') {
end[i] = decomposeString(end[i])
_valuesStart[property] = start
if (Array.isArray(end)) {
if (!Array.isArray(start)) {
end.unshift(start)
for (let i = 0, len = end.length; i < len; i++) {
if (typeof end[i] === 'string') {
end[i] = decomposeString(end[i])
}
}
}
} else {
if (end.isString && object[property].isString && !start.isString) {
start.isString = true
} else {
decompose(property, object, _valuesStart, _valuesEnd)
if (end.isString && object[property].isString && !start.isString) {
start.isString = true
} else {
decompose(property, object, _valuesStart, _valuesEnd)
}
}
} else {
decompose(property, object, _valuesStart, _valuesEnd)
}
if (typeof start === 'number' && typeof end === 'string' && end[1] === '=') {
continue
}
} else {
decompose(property, object, _valuesStart, _valuesEnd)
}
if (typeof start === 'number' && typeof end === 'string' && end[1] === '=') {
continue
}
_valuesStart.processed = true
}

if (Tween.Renderer && this.node && Tween.Renderer.init) {
Expand Down

0 comments on commit 9a54071

Please sign in to comment.