xxxxxxxxxx
70
let t = 0;
let size = 0;
let ctime = 0;
function update() {
t++;
t = t % 60;
}
function mousePressed() {
if (ctime === 0) {
ctime++;
size = size/ctime;
} else {
ctime = 60;
}
}
function showtime() {
textSize(40);
textAlign(CENTER, CENTER);
fill(200);
text(t, width / 2, height / 2);
}
function crosshair() {
stroke(55);
strokeWeight(2);
line(width / 2, 0, width / 2, height);
line(0, height / 2, width, height / 2);
noStroke()
fill(20)
rectMode(CENTER)
rect(width / 2, height / 2, width/4, 100 )
rectMode(CORNER)
stroke(20);
strokeWeight(20);
noFill();
rect(10, 10, width-20, height-20);
}
function circle_draw() {
fill(200);
noStroke();
circle(mouseX, mouseY, 50 - ctime);
}
// MAIN LOOPS
function setup() {
createCanvas(800, 400);
}
function draw() {
background(20);
fill(255-t*4)
update();
crosshair();
showtime();
circle_draw();
}