void QUnifiedTimer::updateAnimationsTime() { //setCurrentTime can get this called again while we're the for loop. At least with pauseAnimations if(insideTick) return; qint64 totalElapsed = time.elapsed(); // ignore consistentTiming in case the pause timer is active int delta = (consistentTiming && !isPauseTimerActive) ? timingInterval : totalElapsed - lastTick; if (slowMode) { if (slowdownFactor > 0) delta = qRound(delta / slowdownFactor); else delta = 0; } lastTick = totalElapsed; //we make sure we only call update time if the time has actually changed //it might happen in some cases that the time doesn't change because events are delayed //when the CPU load is high if (delta) { insideTick = true; for (currentAnimationIdx = 0; currentAnimationIdx < animations.count(); ++currentAnimationIdx) { QAbstractAnimation *animation = animations.at(currentAnimationIdx); int elapsed = QAbstractAnimationPrivate::get(animation)->totalCurrentTime + (animation->direction() == QAbstractAnimation::Forward ? delta : -delta); animation->setCurrentTime(elapsed); } insideTick = false; currentAnimationIdx = 0; } }
void QUnifiedTimer::updateAnimationsTime() { // ignore consistentTiming in case the pause timer is active int delta = (consistentTiming && !isPauseTimerActive) ? timingInterval : time.elapsed() - lastTick; if (slowMode) delta /= 5; lastTick = time.elapsed(); //we make sure we only call update time if the time has actually changed //it might happen in some cases that the time doesn't change because events are delayed //when the CPU load is high if (delta) { for (currentAnimationIdx = 0; currentAnimationIdx < animations.count(); ++currentAnimationIdx) { QAbstractAnimation *animation = animations.at(currentAnimationIdx); int elapsed = QAbstractAnimationPrivate::get(animation)->totalCurrentTime + (animation->direction() == QAbstractAnimation::Forward ? delta : -delta); animation->setCurrentTime(elapsed); } currentAnimationIdx = 0; } }
void QAnimationTimer::updateAnimationsTime(qint64 delta) { //setCurrentTime can get this called again while we're the for loop. At least with pauseAnimations if (insideTick) return; lastTick += delta; //we make sure we only call update time if the time has actually changed //it might happen in some cases that the time doesn't change because events are delayed //when the CPU load is high if (delta) { insideTick = true; for (currentAnimationIdx = 0; currentAnimationIdx < animations.count(); ++currentAnimationIdx) { QAbstractAnimation *animation = animations.at(currentAnimationIdx); int elapsed = QAbstractAnimationPrivate::get(animation)->totalCurrentTime + (animation->direction() == QAbstractAnimation::Forward ? delta : -delta); animation->setCurrentTime(elapsed); } insideTick = false; currentAnimationIdx = 0; } }