Hii, I’m relatively new to processing and am currently trying to recreate this abstract clock: https://www.youtube.com/watch?v=93Jf32V1_FU
I am lost as to how to add a new square randomly on the canvas every minute. And how to add another circle (a size larger than the one that’s there) for every hour. Thanks so much!
So far I have this code:
void setup() {
size (600,600);
smooth ();
background(255,211,153);
}
void draw() {
//background(255,211,153);
int s = second(); // 0 to 59
String seconds = nf(s,2); // nf makes it two characters 2 = 02
int m = minute(); // 0 to 59
String minutes = nf(m,2);
int h = hour(); // 0 to 24
String hours = nf(h,2);
// code below controls the second as rectangles
strokeWeight(20);
stroke(255,168,200);
fill(255,211,153);
float ws = map(s, 0, 59, 0, height); // map(value, start, end, target start, target end)
rect(100, 0, 60, ws); // x, y, width, height
strokeWeight(20);
stroke(255,168,200);
fill(255,211,153);
float ws2 = map(s, 0, 59, 0, height); // map(value, start, end, target start, target end)
rect(210, 0, 60, ws2); // x, y, width, height
strokeWeight(20);
stroke(255,168,200);
fill(255,211,153);
float ws3 = map(s, 0, 59, 0, height); // map(value, start, end, target start, target end)
rect(330, 0, 60, ws3); // x, y, width, height
strokeWeight(20);
stroke(255,168,200);
fill(255,211,153);
float ws4 = map(s, 0, 59, 0, height); // map(value, start, end, target start, target end)
rect(440, 0, 60, ws4); // x, y, width, height
// code below controls the minutes as squares
stroke(222,255,196);
noFill();
float wm = map(m, 0, 59, 0, height); // map(value, start, end, target start, target end)
rect(40, 100, 10, 10); // x, y, width, height
// code below controls the hours as circles
strokeWeight(5);
stroke(87,98,255);
smooth ();
noFill();
float hm = map(h, 0, 24, 0, width); // map(value, start, end, target start, target end)
circle(400,400,20); // x, y, size
}