Jump to content
Search Community

Nested Timelines causing incorrect transforms

smjones 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

Hello!

I am trying to build a timeline that is composed of nested timelines. I am finding that the when I nest the timeline, the yoyo playback(and even the plain repeat) ends up playing the incorrect values and the css matrix gets set incorrectly.

 

It works fine if I add the Tween like this:

  tl.add ( TweenLite.fromTo( ... ))

 

but if I create a new timeline and add that, I get the error.

 tl2 = new TimelineLite();

 tl2.add ( TweenLite.fromTo( ... ));

 tl.add( tl2 )

 

 

I have an example here: http://jsfiddle.net/7h5ED/2/

 

I left it in the broken state, but if you change the showBroken variable to false, you'll see the correct

behavior. It should have a sequence like: slide in from top, zoom out, slide in from right. When this yoyos in the broken state, the reverse zoom goes offscreen instead of to the middle of the screen.

 

Any help would be appreciated! Thanks!

 

 

 

 

 

Link to comment
Share on other sites

Hi,

 

Jack this solved the issue:

$(function(){

    var v = $("div.v"),
    masterTL = new TimelineMax({repeat:-1, yoyo:true}),
    tl1 = new TimelineLite(),
    tl2 = new TimelineLite();

TweenLite.set(v,{top:-137});

    tl1
    .to(v, .75, {top:-34})
    .to(v, .75, {scale:3, opacity:0});
    
    tl2
    .to(v, .0001, {left:300, opacity:1, scale:1})
    .to(v, .75, {left:3, ease:'swing'});
    
    masterTL
        .add(tl1)
        .add(tl2);
    
})

Creating two different timelines and adding them to a parent one. Although the problem remained with the fromTo method and the solution was to add a minimal duration to the tween in order to get the element to the right, at normal scale and opacity.

 

Updated fiddle:

http://jsfiddle.net/7h5ED/3/

 

Cheers,

Rodrigo.

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