Combining whileHover with whileInView #176
Answered
by
rick-hup
thomasjonas
asked this question in
Q&A
-
I'm having some trouble with combining different animation states. I have a button that I want to animate in as soon as it comes into view. But I also want to animate it on hover. But somehow the opacity of the button does not update when I toggle the disabled state of the button. Any idea what would be the right way to do this? Here's a link to a codesandbox and here's my component: <motion.button
:variants="{
initial: { y: 20, opacity: 0 },
visible: { y: 0, opacity: 1 },
'visible-disabled': { y: 0, opacity: 0.25 },
hovered: { scale: 1.5 },
}"
:disabled="disabled"
initial="initial"
:whileHover="'hovered'"
:whileInView="disabled ? 'visible-disabled' : 'visible'"
>CLICK ME</motion.button> |
Beta Was this translation helpful? Give feedback.
Answered by
rick-hup
Jun 25, 2025
Replies: 1 comment
-
@thomasjonas this is a bug. You can report an issue for this. |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
thomasjonas
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@thomasjonas this is a bug. You can report an issue for this.