一些API

/**
* Goto the specified frame index, and pause at this index.
* @param startIndex The animation will pause at this index.
*/
gotoFrameAndPause: function(startIndex){
this._startFrame = this._currentFrame = startIndex;
this._time = this._currentFrame * this._frameInternal;

this.pause();
this._gotoFrame(this._currentFrame);
},
action.gotoFrameAndPause(0)
    _gotoFrame: function(frameIndex){
        var size = this._timelineList.length;
        for(var i = 0; i < size; i++)
        {
            this._timelineList[i]._gotoFrame(frameIndex);
        }
    },
 /**
     * Goto the specified frame index, and start playing from this index.
     * @param startIndex The animation will play from this index.
     * @param [endIndex=] The animation will end at this index.
     * @param [currentFrameIndex=] set current frame index.
     * @param [loop=] Whether or not the animation need loop.
     */
    gotoFrameAndPlay: function(startIndex, endIndex, currentFrameIndex, loop){
        //Consolidation parameters
        var i = 0,
            argLen = arguments.length;
        var num = [],
            bool;
        for(i; i<argLen; i++){
            if(typeof arguments[i] === "boolean"){
                bool = arguments[i];
            }else{
                num.push(arguments[i]);
            }
        }
        startIndex = num[0];
        endIndex = num[1] || this._duration;
        currentFrameIndex = num[2] || startIndex;
        loop = bool!=null ? bool : true;

        this._startFrame = startIndex;
        this._endFrame = endIndex;
        this._currentFrame = currentFrameIndex;
        this._loop = loop;
        this._time = this._currentFrame * this._frameInternal;

        this.resume();
        this._gotoFrame(this._currentFrame);
    },

 

posted @ 2017-08-14 17:03  Quintinz  阅读(123)  评论(0编辑  收藏  举报