public/javascripts/yui/animation/animation-debug.js
function(tween) {
        var frames = tween.totalFrames;
        var frame = tween.currentFrame;
        var expected = (tween.currentFrame * tween.duration * 1000 / tween.totalFrames);
        var elapsed = (new Date() - tween.getStartTime());
        var tweak = 0;
        
        if (elapsed < tween.duration * 1000) { // check if falling behind
            tweak = Math.round((elapsed / expected - 1) * tween.currentFrame);
        } else { // went over duration, so jump to end
            tweak = frames - (frame + 1); 
        }
        if (tweak > 0 && isFinite(tweak)) { // adjust if needed
            if (tween.currentFrame + tweak >= frames) {// dont go past last frame
                tweak = frames - (frame + 1);
            }
            
            tween.currentFrame += tweak;      
        }
    }
function(tween) {
        var frames = tween.totalFrames;
        var frame = tween.currentFrame;
        var expected = (tween.currentFrame * tween.duration * 1000 / tween.totalFrames);
        var elapsed = (new Date() - tween.getStartTime());
        var tweak = 0;
        
        if (elapsed < tween.duration * 1000) { // check if falling behind
            tweak = Math.round((elapsed / expected - 1) * tween.currentFrame);
        } else { // went over duration, so jump to end
            tweak = frames - (frame + 1); 
        }
        if (tweak > 0 && isFinite(tweak)) { // adjust if needed
            if (tween.currentFrame + tweak >= frames) {// dont go past last frame
                tweak = frames - (frame + 1);
            }
            
            tween.currentFrame += tweak;      
        }
    }
function ( tween ) { var frames = tween . totalFrames ; var frame = tween . currentFrame ; var expected = ( tween . currentFrame * tween . duration * 1000 / tween . totalFrames ) ; var elapsed = ( new Date ( ) - tween . getStartTime ( ) ) ; var tweak = 0 ; if ( elapsed < tween . duration * 1000 ) { // check if falling behind tweak = Math . round ( ( elapsed / expected - 1 ) * tween . currentFrame ) ; } else { // went over duration, so jump to end tweak = frames - ( frame + 1 ) ; } if ( tweak > 0 && isFinite ( tweak ) ) { // adjust if needed if ( tween . currentFrame + tweak >= frames ) { // dont go past last frame tweak = frames - ( frame + 1 ) ; } tween . currentFrame += tweak ; } }
On the fly frame correction to keep animation on time.
@method correctFrame
@private
@param {Object} tween The Anim instance being corrected.
On the fly frame correction to keep animation on time .