18 lines
382 B
JavaScript
18 lines
382 B
JavaScript
{ec521c63d9541b2eab96d476e956afa85c4f2b4d true 382 main.js 0xc00b082ee0}
const circles = document.querySelectorAll('.circle')
|
|
let activeLight = 0;
|
|
|
|
setInterval(() => {
|
|
changeLight();
|
|
}, 1000);
|
|
|
|
function changeLight() {
|
|
circles[activeLight].className = 'circle';
|
|
activeLight++;
|
|
|
|
if(activeLight > 2) {
|
|
activeLight = 0;
|
|
}
|
|
const currentLight = circles[activeLight]
|
|
|
|
currentLight.classList.add(currentLight.getAttribute('color'));
|
|
} |