Hey everybody!
I've wanted to make this effect where I'm twinkling two stars, but as you can see in my embedded Codepen at the time of writing, I could only have them animate once at a time.
I want to know if it's possible to have both of these objects animate in a manner which is a split second after each other, e.g. first star fades in and out and then the second star fades in and out, and repeat. Thanks.
See the Pen oeMreo by DavidRizzo (@DavidRiz
Hi @DavidRizzo
To randomize an animation, you can make a function to generate an animation with random values. When the animation completes, call that function again. Rinse and repeat.
I wasn't sure about the exact behavior you wanted, but check this out. The timeline automatically removes animations after they are done playing. When there are no more animations on the timeline, it will call the twinkleStars function again.
See the Pen rzZmY