Jump to content
GreenSock

Susan

Don't know how to incorporate multiple animations for one variable in nest timelines.

Moderator Tag

Recommended Posts

I am having problem to understand how to bind multiple animations into one variable which is in nest timelines.

 

What I would like to achieve is a looping variables like this codepen:

 

See the Pen symha?editors=0110 by GreenSock (@GreenSock) on CodePen

 

But with multiple animations for one/first variable (box1Timeline) like this, mentioned by @OSUblake

 

Kindly assist, thank you!

See the Pen XVWdoZ by susansiow (@susansiow) on CodePen

Link to comment
Share on other sites

You had undefined variables in your demo that is why it wasn't working. You should look into how to debug JavaScript. Again the videos I had suggested, they walk you through all the basic details about how you can chain animations and last two videos show advanced approach of using functions for complex animations.

 

See the Pen qpBNXz?editors=0010 by Sahil89 (@Sahil89) on CodePen

 

  • Like 4
  • Thanks 1
Link to comment
Share on other sites

@Sahil Thank you for the reference, I have a better understanding of how to run the animations.

 

Would you mind to have a look of my 2nd test pen? Kindly advise, if you have any comments, thank you!

 

See the Pen eyYaYJ by susansiow (@susansiow) on CodePen

 

Link to comment
Share on other sites

GSAP part of your demo is correct, I don't see any issues.

 

You are redefining 'target 'variable by using 'var' which is incorrect, it will still work in most browsers but it can throw error in some rare cases. You can reuse same variable without using 'var', though it is better practice to use unique variables for each element.  Plus when you are using editor you will see squiggly lines telling you something is wrong in your code.

  • Thanks 1
Link to comment
Share on other sites

Hi @Susan

 

I would look at using functions to keep your code organized, reusable, and configurable.

 

See the Pen MrwKjB?editors=0010 by osublake (@osublake) on CodePen

 

 

Don't know if you had a chance to look at those videos that @Sahil shared with you, but that's what these ones go over.

 

 

 

 

 

 

  • Like 4
  • Thanks 1
Link to comment
Share on other sites

 

Thank you @Sahil and @OSUblake for the kind directions, I will digest and experiment further, thank you!

Link to comment
Share on other sites

@Sahil I have replaced the targets with unique vars, please take a look and advise if you have any comments. Thanks!

 

See the Pen dJogYN by susansiow (@susansiow) on CodePen

 

  • Like 1
Link to comment
Share on other sites

Ya everything is correct except the callback. You can use repeat: -1 as follows instead of explicitly restarting timeline using callback. Congrats on getting it right, if you keep playing with timelines using different examples you will master it soon.

 

See the Pen KZpGbK?editors=0010 by Sahil89 (@Sahil89) on CodePen

 

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