The Animation interface exposes a playbackRate property to control the animation's speed.
Created attachment 325350 [details] Patch
Comment on attachment 325350 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=325350&action=review > Source/WebCore/animation/WebAnimation.cpp:47 > + , m_playbackRate(1) This could be in the header. > LayoutTests/http/wpt/wk-web-animations/timing-model/animation-playback-rate.html:27 > +test(t => { > + const animation = new Animation(document.timeline); > + animation.startTime = 1; > + animation.playbackRate = 2; > + internals.setTimelineCurrentTime(document.timeline, 3); > + > + assert_equals(animation.startTime, 1); > + assert_equals(animation.currentTime, 4); > + assert_equals(animation.playbackRate, 2); > +}, 'Correctly compute the current time based on the playback rate'); I'd add a test for what happens when the playbackRate is 0.
(In reply to Sam Weinig from comment #2) > > Source/WebCore/animation/WebAnimation.cpp:47 > > + , m_playbackRate(1) > > This could be in the header. Will move to header in commit. > I'd add a test for what happens when the playbackRate is 0. Currently, bad things happen when setting the playback rate to 0. We will deal with that correctly when we implement pausing and the introduce the concept of the hold time. I'm just about to start on that, see webkit.org/b/178932. But we can add a test for getting the current time with playback rate = 0, this already works, and should always report currentTime = 0. Will add another test in the commit.
Committed r224181: <https://trac.webkit.org/changeset/224181>
<rdar://problem/35271079>