Hey Guys,
I’m completely new to processing and i’m trying to build a clock.
I want the top row to indicate the hours (12rects),
the second row to indicate the tens digits for the minutes (6rects),
the third row to indicate the single digits for the minutes (10rects),
the second row to indicate the tens digits for the seconds (6rects) and
the third row to indicate the single digits for the seconds (10rects).
But i can’t get it to work…
I tried "if"s but failed.
Does anybody have any suggestions?
int xs = 0;
int s = second(); // Values from 0 - 59
int m = minute(); // Values from 0 - 59
int h = hour(); // Values from 0 - 23
void setup() {
size (1200, 700);
}
void draw() {
rectMode(CENTER);
fill(255);
rect(49, 49, 100, 100);
rect(149, 49, 100, 100);
rect(249, 49, 100, 100);
rect(349, 49, 100, 100);
rect(449, 49, 100, 100);
rect(549, 49, 100, 100);
rect(649, 49, 100, 100);
rect(749, 49, 100, 100);
rect(849, 49, 100, 100);
rect(949, 49, 100, 100);
rect(1049, 49, 100, 100);
rect(1149, 49, 100, 100);
rect(49, 249, 100, 100);
rect(149, 249, 100, 100);
rect(249, 249, 100, 100);
rect(349, 249, 100, 100);
rect(449, 249, 100, 100);
rect(549, 249, 100, 100);
rect(649, 249, 100, 100);
rect(49, 349, 100, 100);
rect(149, 349, 100, 100);
rect(249, 349, 100, 100);
rect(349, 349, 100, 100);
rect(449, 349, 100, 100);
rect(549, 349, 100, 100);
rect(649, 349, 100, 100);
rect(749, 349, 100, 100);
rect(849, 349, 100, 100);
rect(949, 349, 100, 100);
rect(49, 549, 100, 100);
rect(149, 549, 100, 100);
rect(249, 549, 100, 100);
rect(349, 549, 100, 100);
rect(449, 549, 100, 100);
rect(549, 549, 100, 100);
rect(649, 549, 100, 100);
rect(49, 649, 100, 100);
rect(149, 649, 100, 100);
rect(249, 649, 100, 100);
rect(349, 649, 100, 100);
rect(449, 649, 100, 100);
rect(549, 649, 100, 100);
rect(649, 649, 100, 100);
rect(749, 649, 100, 100);
rect(849, 649, 100, 100);
rect(949, 649, 100, 100);
fill(0);
rect(xs, 649, 100, 100);
if (s == 0) {
xs = 49;
} else if (s == 10) {
xs = 49;
}
}