enter image description herehttps://github.com/sarang997/simulation1 Here is the simulation I am working on. You can try running the html file for it to work. There are circles colliding with each other in the simulation. Whenever a red circle collides with the green circle it changes the color of the green circle to red. Now what I want is as soon as the circle turns red I want a timer which changes its color to blue after n seconds. I am not able to achieve this.
There is a section in the shapes.js file where collision between the circles is detected and thats where I am changing the colors and thats exactly where I want the timer to start. (line 104 and 110 in shapes.js file)