Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds a playbackRate option to anime, which allows an animation to play faster/slower than originally intended.
Rationale:
I have some css animations with keyframes with a user overridden duration, like this:
Since animeJs does not support % keyframes, but only durations, in order to be able to override the duration I'd need to either:
a) make a function that generates the animation by multiplying each duration by some amount
b) make a function that goes over the animation object and multiplies durations, delays, endDelays, time offsets and so on keys by this amount.
Option a is not possible since animations need to be serialized and loaded from a JSON.
Option b is possible, but annoying
Although perhaps the preferable way to solve this issue would be to allow keyframes to express their durations and delays in "x%" in addition to msecs, this PR would solve it by allowing an animation to have a "playbackRate", which would solve my case by making all the base animations 1 second, each % keyframe "0.%" seconds, and setting the playbackRate to the user overridden number of seconds he wants the animation to last.