xxxxxxxxxx
41
let timeLimit = 30;
let countdown;
function setup() {
createCanvas(400, 400);
angleMode(DEGREES);
}
function draw() {
background(0);
translate(200, 200);
rotate(-90);
let currentTime = (millis() / 1000);
countdown = timeLimit - currentTime;
if (countdown < 0) countdown = 0;
//let sc = second();
strokeWeight(4);
noStroke();
//let a = map(countdown, 60, 0, 255, 0);
let r = map(countdown, timeLimit, 0, 0, 225);
let g = map(countdown, timeLimit, 0, 255, 0);
let b = map(countdown, timeLimit, 0, 234, 255);
fill(r, g, b);
//let scAngle = map(sc, 0, 60, 0, 360);
let cdAngle = map(countdown, timeLimit, 0, 360, 0);
//arc(0, 0, 300, 300, 0, scAngle, PIE);
arc(0, 0, 300, 300, 0, cdAngle, PIE);
// fill(255);
// noStroke();
// text(sc, 10, 200);
}