Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
alan0buchanan

Prevent an event-triggered timeline being queued if event is triggered while animation is in progress

Recommended Posts

In my Codepen example, there is a gold circle. When you click the gold circle, it moves around the page using `x` and `y`.

 

If you click the circle while it's moving around, another timeline animation for the circle gets queued and runs after the initial one has finished.

 

I want to prevent this behaviour. My instinct tells me to use lodash `throttle`, but I feel there should be a better way to do this, especially as I would need the duration of the animation to use a throttle.

 

I want any click to the circle to have no effect if the animation is in progress. Is there a `TimelineMax` method I can use to achieve this?

See the Pen gROvjG by alanbuchanan (@alanbuchanan) on CodePen

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.

×