Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
WilliamBay

onRepeat Callback

Recommended Posts

I'm working on a custom Throbber for an upcoming client site.

The idea is that the bird and the bear in the logo will blink their eyes every time the throbber does a full rotation.

 

I've been looking through docs and other code, and can't seem to find the correct setting which will correctly call the eyesTL when the throbTL repeats.

 

Any thoughts?

See the Pen OOoqXm?editors=0010 by bahia0019 (@bahia0019) on CodePen

Link to comment
Share on other sites

You are trying to use timelines as functions, onRepeat callback expects a function. Also you were passing timeline to onload event, which throws error.

 

Also, while using GSDevTools onRepeat callback is being ignored, @GreenSock can explain why it is happening.

 

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

 

  • Like 3
Link to comment
Share on other sites

Ahhh! Yes, duh. Function, not variable. Thanks for that.
Interesting about the DevTools too. I just started using them, very handy. 

  • Like 2
Link to comment
Share on other sites

20 minutes ago, Sahil said:

Also, while using GSDevTools onRepeat callback is being ignored, @GreenSock can explain why it is happening.

 

It's not repeating. It's only playing once. If you add a longer animation somewhere else, you'll see it repeat.

  • Like 3
Link to comment
Share on other sites

No I mean, even if you select animation to repeat from GSDevTools option, it ignores callback. I now understand what is happening but I guess everyone will expect the callback to work.

  • Like 1
Link to comment
Share on other sites

@WilliamBay btw you don't need callback in this particular situation, you can use a master timeline and labels to keep things simple. Also, you might be able to use custom ease to achieve same affect as throbber.

 

Plus, you can set transformOrigin only once and setting it to '50% 50%' works instead of using absolute values. Finally, I don't know if it was intentional use or not, but when you use fromTo tween, you are animating particular property from certain value passed in first parenthesis to a certain value passed in second parenthesis. So in this situation you don't need fromTo tween. Neither do you need yoyo property, instead of jumping to start position while repeating yoyo animates it in reverse.

 

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

 

  • Like 5
Link to comment
Share on other sites

@Sahil THANK YOU! Those are all very helpful comments. I really appreciate it. 

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