commitStyles method
The commitStyles()
method of the
Web Animations API's
Animation interface writes the
computed values
of the animation's current styles into its target element's
style
attribute. commitStyles()
works even if the animation has been
automatically removed.
commitStyles()
can be used in combination with fill
to cause the final
state of an animation to persist after the animation ends. The same effect
could be achieved with fill
alone, but
using indefinitely filling animations is discouraged.
Animations
take precedence over all static styles,
so an indefinite filling animation can prevent the target element from
ever being styled normally.
Using commitStyles()
writes the styling state into the element's
style
attribute, where they can be modified and replaced as normal.
Implementation
external void commitStyles();