xoxoxoxo Posted September 17, 2020 Share Posted September 17, 2020 I'm animating a div in a timeline, however i'd like to perform some action in the middle of it. I tried `onComplete` but looks like that only works when timeline ends. Ideally, I'd like to add perfromAction on the second timeline when the div's x value reaches to 100% tl .to(div, 1, { x: 0 }) .to(div, 1, { x: '100%' }) .to(title, 1, { height: 0, opacity: 0, y: -50 }, '<=0.5'); Link to comment Share on other sites More sharing options...
akapowl Posted September 17, 2020 Share Posted September 17, 2020 Hey @nullhook you can actually throw an onComplete on every tween you like in that timeline, e.g.: tl .to(div, 1, { x: 0 }) .to(div, 1, { x: '100%', onComplete: function() { doYourMagicHere(); } }) .to(title, 1, { height: 0, opacity: 0, y: -50 }, '<=0.5') ; 2 Link to comment Share on other sites More sharing options...
xoxoxoxo Posted September 17, 2020 Author Share Posted September 17, 2020 I should've known! Thanks! 1 Link to comment Share on other sites More sharing options...
ZachSaucier Posted September 18, 2020 Share Posted September 18, 2020 See all the callback options available by using the docs 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