Jump to content
GreenSock

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

Weird timeline behaviour

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

When adding a tween with a negative offset, but with a duration that does not exceed the previous tween, things start to behave weird when restarting the timeline. I created a small codepen example to demonstrate this.

 

It seems like the first tween does not get overwritten by the second tween but only after the first tween finished for the first time.

 

[edit]

using relative ("+=100") or absolute (100) values does not make any difference

 

[edit2]

using  tl.reverse(); instead of tl.restart() breaks the animation entirely

See the Pen JGjYPW by anon (@anon) on CodePen

Link to comment
Share on other sites

Hi m6246  :),

 

This is from the docs:

 

By default, whenever a TweenLite instance renders for the first time (after any delay), it analyzes all other active tweens of the same target and checks for individual overlapping properties. If it finds any, it kills the offending overlaps (again, only the individual properties). This overwrite mode is called "auto" and it is typically the most intuitive.

 

You can read more here:

https://greensock.com/get-started-js#overwriting

 

You should also check out the position parameter demos for more information:

http://greensock.com/position-parameter

 

Happy tweening :)

  • Like 1
Link to comment
Share on other sites

Yep, PointC is exactly correct. You're creating conflicting tweens. One is trying to force box.y to 100 more, and another is trying to force it to 40 more. You can't have it both ways :) The 2nd tween overwrites the first, thus when the repeat occurs, that tween is no longer trying to animate box.y. 

 

You can set overwrite:false on the tween(s), but just be careful - that means the engine will allow you to create and run conflicting tweens that are fighting with each other, so you might see a weird jump at the end of a tween. Ultimately from what I can tell, the issue here is just a logic one in the way you're writing/scheduling your tweens. 

 

Does that help? 

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