Jump to content
Search Community

on.("mousedown",myFunction)

makis2404 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

Hi @makis2404 :)

 

Your demo didn't embed properly, but I found it in your profile.

 

The reason that doesn't work is you have each click create a tween that is added to the end of the timeline. The first tween on the timeline is 100 seconds in duration so the y position animation tweens won't happen until that tween ends. You could create a separate timeline for the click handler or you could simply use TweenMax like this:

 

 

See the Pen LBawgN by PointC (@PointC) on CodePen

Keep in mind that on the first click the square will move up to y:0 since you're animating the attribute 'y'. I'm assuming you don't want that so I set the variable to 200 instead of 0.

 

That should get you started. Happy tweening.

:)

 

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