diff options
Diffstat (limited to 'src/animation/Morphable.js')
-rw-r--r-- | src/animation/Morphable.js | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/animation/Morphable.js b/src/animation/Morphable.js index 93debe7..0a28e8e 100644 --- a/src/animation/Morphable.js +++ b/src/animation/Morphable.js @@ -195,6 +195,10 @@ TransformBag.defaults = { originY: 0 } +const sortByKey = (a, b) => { + return (a[0] < b[0] ? -1 : (a[0] > b[0] ? 1 : 0)) +} + export class ObjectBag { constructor (...args) { this.init(...args) @@ -215,9 +219,7 @@ export class ObjectBag { entries.push([ i, objOrArr[i] ]) } - entries.sort((a, b) => { - return a[0] - b[0] - }) + entries.sort(sortByKey) this.values = entries.reduce((last, curr) => last.concat(curr), []) return this |