Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions cocos2d/actions/CCActionInterval.js
Original file line number Diff line number Diff line change
Expand Up @@ -3263,7 +3263,8 @@ cc.Animate = cc.ActionInterval.extend(/** @lends cc.Animate# */{
_nextFrame:0,
_origFrame:null,
_executedLoops:0,
_splitTimes:null,
_splitTimes: null,
_currFrameIndex:0,

/**
* Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function. <br />
Expand Down Expand Up @@ -3291,6 +3292,14 @@ cc.Animate = cc.ActionInterval.extend(/** @lends cc.Animate# */{
this._animation = animation;
},

/**
* Gets the index of sprite frame currently displayed.
* @return {Number}
*/
getCurrentFrameIndex: function () {
return this._currFrameIndex;
},

/**
* @param {cc.Animation} animation
* @return {Boolean}
Expand Down Expand Up @@ -3373,7 +3382,8 @@ cc.Animate = cc.ActionInterval.extend(/** @lends cc.Animate# */{
var numberOfFrames = frames.length, locSplitTimes = this._splitTimes;
for (var i = this._nextFrame; i < numberOfFrames; i++) {
if (locSplitTimes[i] <= dt) {
this.target.setSpriteFrame(frames[i].getSpriteFrame());
_currFrameIndex = i;
this.target.setSpriteFrame(frames[_currFrameIndex].getSpriteFrame());
this._nextFrame = i + 1;
} else {
// Issue 1438. Could be more than one frame per tick, due to low frame rate or frame delta < 1/FPS
Expand Down