From 21fdff8cd536cb586b85425c741622f2b3e3a291 Mon Sep 17 00:00:00 2001 From: 2youyouo2 <501251991@qq.com> Date: Tue, 1 Aug 2017 16:44:51 +0800 Subject: [PATCH] improve WrappedInfo.prototype.set performance --- cocos2d/animation/types.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/cocos2d/animation/types.js b/cocos2d/animation/types.js index 3c2d125965..09fe78fbe8 100644 --- a/cocos2d/animation/types.js +++ b/cocos2d/animation/types.js @@ -84,12 +84,16 @@ function WrappedInfo (info) { this.direction = 1; this.stopped = true; this.iterations = 0; + this.frameIndex = undefined; } WrappedInfo.prototype.set = function (info) { - for (var k in info) { - this[k] = info[k]; - } + this.ratio = info.ratio; + this.time = info.time; + this.direction = info.direction; + this.stopped = info.stopped; + this.iterations = info.iterations; + this.frameIndex = info.frameIndex; }; /**