drNo77 Posted February 8, 2023 Share Posted February 8, 2023 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 More sharing options...
Solution Andy Bui Posted February 8, 2023 Solution Share Posted February 8, 2023 hi drNo77, Just put it in a loop and you won't have to repeat copy and paste the same tween again See the Pen PoBvGbj by tcb2307 (@tcb2307) on CodePen 3 Link to comment Share on other sites More sharing options...
drNo77 Posted February 8, 2023 Author Share Posted February 8, 2023 Thanks, Andy! I should've known it was something that simple.💡 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