public virtual void advanceTime(float time) { if (time == 0 || (mRepeatCount == 1 && mCurrentTime == mTotalTime)) { return; } int i = 0; float previousTime = mCurrentTime; float restTime = mTotalTime - mCurrentTime; float carryOverTime = time > restTime ? time - restTime : 0.0f; mCurrentTime = AsMath.min(mTotalTime, mCurrentTime + time); if (mCurrentTime <= 0) { return; } if (mCurrentCycle < 0 && previousTime <= 0 && mCurrentTime > 0) { mCurrentCycle++; if (mOnStart != null) { mOnStart((float)(mOnStartArgs[0])); } } float ratio = mCurrentTime / mTotalTime; bool reversed = mReverse && (mCurrentCycle % 2 == 1); int numProperties = (int)(mStartValues.getLength()); for (i = 0; i < numProperties; ++i) { if (AsGlobal.isNaN(mStartValues[i])) { mStartValues[i] = ((AsObject)(mTarget)).getOwnProperty(mProperties[i]) as float; } float startValue = mStartValues[i]; float endValue = mEndValues[i]; float delta = endValue - startValue; float transitionValue = reversed ? mTransitionFunc(1.0f - ratio) : mTransitionFunc(ratio); float currentValue = startValue + transitionValue * delta; if (mRoundToInt) { currentValue = AsMath.round(currentValue); } ((AsObject)(mTarget)).setOwnProperty(mProperties[i], currentValue); } if (mOnUpdate != null) { mOnUpdate((float)(mOnUpdateArgs[0])); } if (previousTime < mTotalTime && mCurrentTime >= mTotalTime) { if (mRepeatCount == 0 || mRepeatCount > 1) { mCurrentTime = -mRepeatDelay; mCurrentCycle++; if (mRepeatCount > 1) { mRepeatCount--; } if (mOnRepeat != null) { mOnRepeat((float)(mOnRepeatArgs[0])); } } else { AsTransitionCallback onComplete = mOnComplete; AsArray onCompleteArgs = mOnCompleteArgs; dispatchEventWith(AsEvent.REMOVE_FROM_JUGGLER); if (onComplete != null) { onComplete((float)(onCompleteArgs[0])); } } } if (carryOverTime != 0) { advanceTime(carryOverTime); } }