Jump to content
Search Community

TimelineMax with multiple Tweenmax objects Reverse only last Tweenmax

fiatuno 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

Hi

I have simple code as below adding TweenMax obects to the TimelineMax 

 

timeline = new TimelineMax({repeat: false, paused: true,
  onComplete: cleanTweens,
  onReverseComplete: reverseComplete});

 

//note arr is an array of objects and duration, delay and xand y varies sets based on function calls has been omitted for brevity

for(var i = 0; i < arr.length; i++){
   timeline.add(TweenMax.to(arr[i], someDuration, {
    x:someX,
    y:someY,
    rotate:(x * Math.PI)/180, // handled in updateDraw
    ease:Quint.easeOut,
    onUpdate:updateDraw
   }), someDelay)

}

then 
timeline.restart();

and later on based on request will replay like below

 

timeline.reverse(0, false);

 

Issue this vill replay tweens of only last ojects or it appears to play only last tweens.

any help appreciated

 

Thanks

 

 

 

 

 

 

 

Link to comment
Share on other sites

I read your question a few times but I don't understand what you're asking. Can you provide a reduced test case as a codepen so that we can see what's going on? 

 

Also, if you're animating transforms (maybe you're not), "rotate" should be "rotation".  

 

I wonder if you're creating overlapping tweens of the same object which would cause overwriting to kick in. You could set overwrite:false and see if that resolves things, but beware that when you create overlapping tweens that overwrite, they're literally fighting each other for control of the same property at the same time, so be careful about setting overwrite:false. 

 

Lastly, you can make your code more concise by tapping into the convenience methods of TimelineMax. Instead of timeline.add( TweenMax.to(...), someDelay) you can simply do timeline.to(..., someDelay) :)

  • Like 3
Link to comment
Share on other sites

8 minutes ago, GreenSock said:

Also, if you're animating transforms (maybe you're not), "rotate" should be "rotation".  

 

Looks like canvas code.

 

But yeah, a demo would help. Code snippets don't tell the whole story. For example, your cleanTweens callback sounds kind of suspect.

  • Like 4
Link to comment
Share on other sites

  • 2 weeks later...

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