A common pattern in animations based on scroll/hover is adding interpolation from last position to current position, so that a smooth movement is achieved even on abrupt progress changes, e.g. clicking on the scrollbar in a different location.
I proposed adding this effect by defining the interaction of Animation.playbackRate with non time-based animations here: #7059 (comment).
The Web Animations API 1 spec of Animation's playbackRate:
Animations have a playback rate that provides a scaling factor from the rate of change of the associated timeline’s time values to the animation’s current time.
If we translate that into non time-based (non-monotonic timelines) it's effectively a linear interpolation on each frame between current progress and last progress, so on each frame the progress' update becomes:
new_progress = last_progress * (1 - playbackRate) + current_progress * playbackRate
And this maintains an effectively paused animation on playbackRate == 0 and a flipped progress for playbackRate == -1.
In respect to Scroll-driven timelines progress is described as:
The startmost scroll position represents 0% progress and the endmost scroll position represents 100% progress.
I've created a demo that I hopes at least captures the nature of this feature: https://codepen.io/ydaniv/pen/VwBojoN
Notice that the effect is mostly prominent from playbackRate=~0.1 and below, because of its exponential nature.
I think this feature is orthogonal to the Transition delays feature suggested in #7059, although it creates a similar effect.
cc @birtles @flackr @fantasai @smfr
A common pattern in animations based on scroll/hover is adding interpolation from last position to current position, so that a smooth movement is achieved even on abrupt progress changes, e.g. clicking on the scrollbar in a different location.
I proposed adding this effect by defining the interaction of
Animation.playbackRatewith non time-based animations here: #7059 (comment).The Web Animations API 1 spec of Animation's playbackRate:
If we translate that into non time-based (non-monotonic timelines) it's effectively a linear interpolation on each frame between current progress and last progress, so on each frame the progress' update becomes:
And this maintains an effectively paused animation on
playbackRate == 0and a flipped progress forplaybackRate == -1.In respect to Scroll-driven timelines progress is described as:
I've created a demo that I hopes at least captures the nature of this feature: https://codepen.io/ydaniv/pen/VwBojoN
Notice that the effect is mostly prominent from
playbackRate=~0.1and below, because of its exponential nature.I think this feature is orthogonal to the Transition delays feature suggested in #7059, although it creates a similar effect.
cc @birtles @flackr @fantasai @smfr