xxxxxxxxxx
var clockFace;
function preload() {
clockFace = loadImage('clockFace.png');
}
function setup() {
createCanvas(windowWidth, windowHeight);
imageMode(CENTER);
ellipseMode(CENTER);
noStroke();
}
function draw() {
background(246);
image(clockFace, width/2, height/2-5, 410, 430);
push();
translate(width/2, height/2);
translate(p5.Vector.fromAngle(radians(second() * 6) - HALF_PI, 143));
fill('red');
ellipse(0, 0, 15, 15);
pop();
push();
translate(width/2, height/2);
translate(p5.Vector.fromAngle(radians(minute() * 6) - HALF_PI, 123));
fill('blue');
ellipse(0, 0, 20, 20);
pop();
push();
translate(width/2, height/2);
var h = hour();
if (h > 12) {h = h - 12;}
translate(p5.Vector.fromAngle(radians(h * 30) - HALF_PI, 98));
fill('green');
ellipse(0, 0, 25, 25);
pop();
}