Hi guys. I understand that this question has been asked in the past, but unfortunately previous answers didn’t help me.
Here is a playground explaining the issue.
Basically, I’ve created like hover animation.
- user hover over the object, it animates.
- user hover out the object, it animates back
If user hovers out before the initial hovering over animation is done, I want to get the current frame of the animation where it stopped and start hoverOut animation from that frame to starting frame (0).
Currently, if you hover out while hover over is playing, it will play the hover out animation from end to begining (animation.to, animation.from).
So basically instead of having
hoverAnimation.start(false, 2, hoverAnimation.to, hoverAnimation.from);
It should be something like
hoverAnimation.start(false, 2, currentFrame, hoverAnimation.from);
I saw people mentioning
hoverAnimation.animatables[0].masterFrame
But hoverAnimation.animatables is empty object in my case (if you remove comments on console logs in the code you can see that).
How can I deal with this properly? I don’t want my animation to “jump” if I leave the hover early.