예제 #1
0
void AnimationTimeline::setPlaybackRate(double playbackRate) {
    if (!isActive())
        return;
    double currentTime = currentTimeInternal();
    m_playbackRate = playbackRate;
    m_zeroTime = playbackRate == 0 ? currentTime
                 : document()->animationClock().currentTime() -
                 currentTime / playbackRate;
    m_zeroTimeInitialized = true;

    // Corresponding compositor animation may need to be restarted to pick up
    // the new playback rate. Marking the effect changed forces this.
    setAllCompositorPending(true);
}
void AnimationTimeline::setCurrentTimeInternal(double currentTime)
{
    if (!isActive())
        return;
    m_zeroTime = m_playbackRate == 0
        ? currentTime
        : document()->animationClock().currentTime() - currentTime / m_playbackRate;
    m_zeroTimeInitialized = true;

    for (const auto& animation : m_animations) {
        // The Player needs a timing update to pick up a new time.
        animation->setOutdated();
    }

    // Any corresponding compositor animation will need to be restarted. Marking the
    // effect changed forces this.
    setAllCompositorPending(true);
}