Jump to content


Yoyo Animation with variations in timing

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

Recommended Posts

We are just trying to convert our clients Flash-Animations to GSAP.

You can see a part of it in the Codepen URL. I used a Yoyo-Animation to make the eyes blink. But to make it feel more natural, I want some variations in the blinking. The time between the blinks is now at one second. How can I achieve these variations, so that ,for example, one time it takes 1 second, the next time it takes 2 seconds and so on. How can I achieve this?

Thx in advance!


See the Pen xGNzaO by anon (@anon) on CodePen

Link to comment
Share on other sites

One way to do this would be to make the blink timeline repeat and yoyo. When it is complete call a function that waits a random amount of time to tell it to restart again using TweenLite.delayedCall() like





**note I simplified the demo a little as it was hard to translate

  • Like 6
Link to comment
Share on other sites

Diaco's solution is very nice!

Link to comment
Share on other sites

Hey, great solutions!

Thank you very much, Diaco and Carl! :)


I'm using Carls solution, because - for me, as a No-Coder - it's somehow more readable.

I adapted the timing it a little bit to make the blinking eyes look more natural.


I have to study Diaco's solution in depth, so that I understand how it's working...  :D


See the Pen zGQLbP by anon (@anon) on CodePen

Link to comment
Share on other sites

I pasted the wrong URL in the last message.

Here is the correct one. But it's just the adapted timing for the blinking eyes... so not much to see ;)


See the Pen BNePgy by anon (@anon) 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.