Jump to content
Search Community

Reversing timeline with not(this) - simple demo

smallio 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

Super simple demo here to illustrate the problem.

 

Clicked white box should go to the centre of the screen & the others should fade out. Works the first time until you reverse (click top blue box) & then try to click another white box.

 

What's the best route to fix this? I feel like the problem lies within the stored variable not updating in time or holding on to the wrong info.

 

Cheers!

See the Pen EMXgWM?editors=0010 by smallio (@smallio) on CodePen

Link to comment
Share on other sites

The problem is that you keep putting more and more and more tweens (of the same elements) into the same timeline at the same spots, often with conflicting values (some trying to make the opacity of an element go to 1, some trying to make the same element's opacity go to 0). I'd recommend simply calling clear() on the timeline to dump out the old animations before populating it with new ones, like this: 

 

 

Does that help? 

 

  • Thanks 1
Link to comment
Share on other sites

3 minutes ago, GreenSock said:

The problem is that you keep putting more and more and more tweens (of the same elements) into the same timeline at the same spots, often with conflicting values (some trying to make the opacity of an element go to 1, some trying to make the same element's opacity go to 0). I'd recommend simply calling clear() on the timeline to dump out the old animations before populating it with new ones, like this: 

 

 

Does that help? 

 

 

Superb Jack thank you so much :) 

 

I shall be renewing my membership once I get paid this month. This forum is honestly the best in the world.

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