Jump to content
Search Community

How to randomise and swap multiple colours repeatedly?

drNo77 test
Moderator Tag

Go to solution Solved by Andy Bui,

Recommended Posts

I am experimenting with an array of colours in a single tween. I think I'm heading towards the right direction so far, as you can see the colours change on load. I did it by applying Math.round to calculate and randomise the different colours inside a single tween, and have it on repeat to see how it goes back and forth between the original colours and random colours.  

 

What I want to do now is to keep swapping colours per each circle multiple times. The only way I could achieve this if I copy and paste the same tween every time, but there has to be a better and tidier way to achieve this than repeating the same tween over again. I was thinking maybe I need to write a function with random values and call it on the tween, but I tried that using another test on my local computer but it didn't work.

What do you all reckon?

See the Pen zYLbJKG by DavidRizzo (@DavidRizzo) 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.
×
×
  • Create New...