Jump to content
Search Community

Gsap hooks with Vue js

Nasr Galal test
Moderator Tag

Recommended Posts

Hey Nasr.

 

It's hard to say because we don't have a minimal demo to make sure. Even if you just post the relevant code in the post (not a whole demo, though a demo is preferable) it'd help. 

 

But I believe that the issue is that you are using relative tweens every time. So the second time you run it, it doesn't have as far to animate because the starting values are the same (or near) the end values already. That's actually one of the most common GSAP mistakes:

 

Your options are outlined in the post above:

Quote

The fix for this is simple: use a .fromTo(). Alternatively you could create the animation beforehand and use a control method (we'll talk more about this approach later in this article).

 

Link to comment
Share on other sites

Why are you using onStart and onComplete listeners for this? It'd be much easier to set things up completely in one timeline and using the position parameter to position things.

 

Additionally, it'd make your code much shorter, easier to change, and easier to understand if you used a loop to create the gear animations. Here's how I'd do it:

See the Pen oNbRooE?editors=0010 by GreenSock (@GreenSock) on CodePen

 

Not using loops is one of the common GSAP mistakes. I highly recommend reading the whole article:

 

Side note, you can just use ease: "none" instead of ease: Linear.easeNone.

  • Like 2
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...