Jump to content
Search Community

Issue Vue + debounce + mouse enter/leave

TerraHQ test
Moderator Tag

Recommended Posts

hey!
so I’m doing this little animation for this blue card where:
1) on mouseover I do a .5 duration initial animation
) on mouseleave I’ve got a different .25 duration animation.

All animations are triggered after hovering the Explore button at the bottom.
The mouseover and mouseleave event are naturally triggered so fast that I’m delaying all animations using debounce.
However, even if each method is triggered correctly (you can check the console messages), if you move the mouse very fast over the Explore button, even when you leave the button and the message says ‘mouseleave’, the animation is still on and bugged. The only way to solve this is if I’ve got 1 animation played and played on reverse or 2 animations but with the same duration.

Why is this bug?
Thanks in advance

See the Pen rNYEJMP?editors=0110 by elisabetperez (@elisabetperez) on CodePen

Link to comment
Share on other sites

This could happening because every time you mouse over or out of the button, you are creating a new gsap timeline, and the wires are getting crossed because of that. You might consider setting up the timelines with paused: true outside of the mouse actions, and running tl.play() from inside. You may need to invalidate the timelines more here: https://greensock.com/docs/v3/GSAP/Tween/invalidate()

  • Like 1
Link to comment
Share on other sites

hey @OSUblake @mvaneijgen @elegantseagulls
Still working on this. 
My main goal is to have 2 complete diff animations.
I know that the user is not going to enter/leave super fast, but I want to accomplish the best experience if possible.

See the Pen gOoboZQ by elisabetperez (@elisabetperez) on CodePen

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...