Share Posted December 12, 2017 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 More sharing options...
Share Posted December 12, 2017 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 4 1 Link to comment Share on other sites More sharing options...
Author Share Posted December 14, 2017 @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 More sharing options...
Share Posted December 14, 2017 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. 1 Link to comment Share on other sites More sharing options...
Share Posted December 14, 2017 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. 4 1 Link to comment Share on other sites More sharing options...
Author Share Posted December 14, 2017 Thank you @Sahil and @OSUblake for the kind directions, I will digest and experiment further, thank you! Link to comment Share on other sites More sharing options...
Author Share Posted December 15, 2017 @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 1 Link to comment Share on other sites More sharing options...
Share Posted December 15, 2017 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 More sharing options...
Author Share Posted December 15, 2017 Hi @Sahil I have created another pen with the repeat value, thank you! Happy weekend! See the Pen xpGyer by susansiow (@susansiow) on CodePen 1 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now