Jump to content
Search Community

TweenMax.to doesn't working

Yaaaaar test
Moderator Tag

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

Recommended Posts

I call a function when im clicking on button, that's correct. On first click everything is working correct, but when i'm clicking second time ball that moved to the end does not move to the left. So question is why it isn't moving at second click?

Link to comment
Share on other sites

Hi and welcome to the forums.

 

Thanks for the demo.

 

Open up dev tools when your animations runs and inspect the ball.

 

-xhTK3-2QCKUZQkbNgWDmQ.png

 

You will see that the right value is being animated but you are not seeing any motion.

This is because your first tween is animating the css right value and your bezier tween is animating the css left value.

 

When you run the sequence the second time your ball has left and right styles applied. Animating the right does not affect the position because left is already set.

 

Please see this reduced test case with no javascript

 

Notice in the css I set right:300px; and left:300px; In this case the browser will only honor the left:300px;

See the Pen ZaMGxo by GreenSock (@GreenSock) on CodePen

 

 

 

 

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