useAnimate question, not a bug
See original GitHub issueHi,
Simple question regarding the useAnimate hook. I was making a slider that is controlled by a prop and before I simply used that prop to revert the animation I was trying something like this:
const { play, style } = useAnimate({
start: { transform: `translateY(${showContent ? '100%' : '0%'})`},
end: { transform:`translateY(${showContent ? '0': '100%'})` },
});
useEffect(() => {
play(true);
}, [show]);
My question is more of a curiosity, but why doesn’t the first implementation work like expected? Is it a misunderstanding of how the useEffect hook works?
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Actions are not set when calling useAnimations #377 - GitHub
Suggested solution: I see two problems here: A typescript error; A bug on the set. For the error: typescript error
Read more >Framer Motion | Viewpoint 'useAnimation' triggers after the last ...
I've been doing a recommended way to do it, but only with one element. When I add more elements, animations will only trigger...
Read more >Animate CC drawing bug for Windows 10 Tablet PC users.
Solved: This issue is NOT solved Animate CC has a serious bug pertaining to all Tablet PC devices using Windows 10, whenever you...
Read more >Bug - Following a Target isn't working under Animator if ...
I am facing a very strange problem. ... Bug Following a Target isn't working under Animator if "Animate Physics" option is enabled.
Read more >Why would anyone choose to use Animate Pro? - Moho Forum
AS just isn't designed to optimize a frame-by-frame workflow, ... Anyway, to answer the OP's question, "Why would anyone choose Animate Pro?
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
oh! i see now what you meant about the previous question about showContent,
show
was the original prop name but I changed it when copying it to the comments here, and made an entirely different issue. The show content would never change andplay
would never get called, my bad.😓I really should have linked an example repo from the start instead: https://codesandbox.io/embed/blazing-currying-qf9zz
in the example the first box is using the non-working impl, while the second uses the hooks.
sorry about the confusion 😬
I think this is the right solution which you posted:
i haven’t test it, but look at this example, your animation probably would stay the same, because RSA wouldn’t be able to change the style because play is not been called