Is your feature request related to a problem? Please describe.
In some situation I need to stop animating an element from running animation and remove all animation effects. Make it look like the animation never ran.
I see that motion does style persistence automatically internally. But the cancel interface only calls the WAAPI interface without deleting the style.
|
cancel() { |
|
const { resolved } = this |
|
if (!resolved) return |
|
resolved.animation.cancel() |
|
} |
Describe the solution you'd like
I want the cancel interface
- Ability to remove internally set styles together.
- Alternatively, use the style override of the initial state.
Describe alternatives you've considered
Another solution is that the stop interface no longer checks the value of time, so I can achieve the goal by setting time = 0 and then calling the stop interface.
const animaion = animate();
await animation;
animation.time = 0;
animation.stop();
Additional context
My temporary solution was to manually remove the style on the element using element.style.cssText = ''.
Is your feature request related to a problem? Please describe.
In some situation I need to stop animating an element from running animation and remove all animation effects. Make it look like the animation never ran.
I see that
motiondoes style persistence automatically internally. But thecancelinterface only calls the WAAPI interface without deleting the style.motion/packages/framer-motion/src/animation/animators/AcceleratedAnimation.ts
Lines 418 to 422 in ecd97f7
Describe the solution you'd like
I want the
cancelinterfaceDescribe alternatives you've considered
Another solution is that the
stopinterface no longer checks the value oftime, so I can achieve the goal by settingtime = 0and then calling thestopinterface.motion/packages/framer-motion/src/animation/animators/AcceleratedAnimation.ts
Line 383 in ecd97f7
Additional context
My temporary solution was to manually remove the style on the element using
element.style.cssText = ''.