Jump to content
makis2404

on.("mousedown",myFunction)

Recommended Posts

I want the svg rect to go downstairs on.("mousedown",goDown)

May be something is required that I don't know well.

Thanks.

See the Pen by pen (@pen) on CodePen

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.