chevohin Posted November 24, 2020 Share Posted November 24, 2020 Hi guys, could you please explain me how it works? I have a jumping ball. I want some functions to be called on start and at the end of each jump. If I use onStart() and onComplete() methods, it runs start function only once and doesn't run finish function at all. I guess, onStart() and onComplete() methods mean the start and the end of the whole timeline, but not every iteration. What is the best way to call functions on start and at the end of each iteration? See the Pen dypbYYE by chevohin (@chevohin) on CodePen Link to comment Share on other sites More sharing options...
ZachSaucier Posted November 24, 2020 Share Posted November 24, 2020 I think you're looking for the onRepeat callback. All of the callbacks are listed in the docs. 2 Link to comment Share on other sites More sharing options...
chevohin Posted November 24, 2020 Author Share Posted November 24, 2020 Zach, i changed onStart to onRepeat, but it doesn't call my function. What am i doing wrong in this new codepen? See the Pen LYRPRYG by chevohin (@chevohin) on CodePen Link to comment Share on other sites More sharing options...
ZachSaucier Posted November 24, 2020 Share Posted November 24, 2020 You're applying the onRepeat to the tween but the timeline is what has the repeat. Apply the onRepeat to the timeline instead. Additionally you can leave out the quotation marks around your y value. Same thing with the duration. 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