Jump to content
GreenSock

Hector18

Timeline reverse animation

Recommended Posts

Hi,

 

I have this timeline function on next slide click event from my slider:

 

var tl = new TimelineLite();    
                        
var tl = new TimelineLite();
    $('.content1').find('.box').each(function(index, element) {
        tl.to(element, 0.5, {scale:0.9, x:100, opacity:0, ease:Power2.easeInOut}, index * 0.02)
    });

 

What I want to achieve is on prev slide click event is the timeline animation to start form the last element and end to first element. How can I do this?

 

Thank you!

See the Pen QZQabv by Hector18 (@Hector18) on CodePen

Link to comment
Share on other sites

Hi @Hector18,


Your case reduced in a CodePen would be helpful to understand what you want.

 

Best regards

Mikel

Link to comment
Share on other sites

HI @Hector18,

 

As @mikel said it makes things far more clear if we can see a CodePen example of the issue.

 

Are you looking for GSAP's reverse() functionality? https://greensock.com/docs/TweenMax/reverse()

 

From the look of things, you might be best using GSAP's StaggerTo functionality https://greensock.com/docs/TweenMax/static.staggerTo() too.

  • Like 1
Link to comment
Share on other sites

Hi,

 

See the Pen QZQabv by Hector18 (@Hector18) on CodePen

 

Just created a pen. For Second row I want animation to start first from box number 6, not from box number 1 like in the first row.

 

Thanks

Link to comment
Share on other sites

How can I do with 2 timelines, like in my example? Thank you!

Link to comment
Share on other sites

Rereading your question, I think @mikel had a better understanding of what you were asking for.

 

I updated my Pen as well. On the StaggerTo, the last value (0.1 and -0.1), in this case, dictates which direction the StaggerTo happens.

 

See the Pen XxZVoQ?editors=0010 by elegantseagulls (@elegantseagulls) on CodePen

 

  • Like 1
Link to comment
Share on other sites

Yes, this is the right solution for my project

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