Jump to content
Search Community

If ThrowPropsPlugin.to tween is in progress and a TweenLite.to is triggered the ThrowProps onComplete never runs.

bonassus 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

If ThrowPropsPlugin.to tween is in progress and a TweenLite.to is triggered the ThrowProps onComplete never runs. what happens to the first tween? Is it still using resorces or do i need to/can I, kill it with TweenLite.killTweensOf or something else that i'm not seeing? 

ThrowPropsPlugin.to(target, {throwProps:{x:{velocity:movment, min:xValue, max:xValue}},ease:Strong.easeOut,onComplete:tpend},1,.5);

if(target.x < 0)
{
TweenLite.to(target, .5, {x:-600,onComplete:onOffStage, onCompleteParams:[target]});
}

Thanks a lot,

 

B

 

 

 

Link to comment
Share on other sites

Good question.

 

Regardless of whether or not throwProps is involved, whenever 2 tweens compete for control over the same properties of the same object a decision needs to be made on how that conflict will be handled.

 

GSAP has a variety of overwrite modes which allow you to specify which tweens should be prioritized and which ones should be killed.

 

The default mode is auto:

 

auto: when the tween renders for the first time, it will analyze tweens of the same target that are currently active/running and only overwrite individual tweening properties that overlap/conflict. Tweens that haven't begun yet are ignored. For example, if another active tween is found that is tweening 3 properties, only 1 of which it shares in common with the new tween, the other 2 properties will be left alone. Only the conflicting property gets overwritten/killed. This is the default mode and typically the most intuitive for developers.

 

 

read about all modes in TweenLite docs under Special Properties: 

http://api.greensock.com/js/com/greensock/TweenLite.html

 

In your case, both tweens are tweening the x property. When the TweenLite tween starts it realizes that another tween is controlling the x of target. Since the TweenLite tween is the most recent tween created, the decision is made that it should not only control the x value of target, but the ThrowProps tween is killed.  The throwProps tween stops immediately and is made eligible for garbage collection. It will never complete.

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