Using a computers clock to trigger change
in
Programming Questions
•
2 years ago
Hello,
Here is my simple code;
void setup() {
size (1200,600);
noStroke();
smooth();
colorMode(HSB);
}
void draw() {
float sat1 = map(millis()000,0,10000,0,255);
float sat2 = map(millis()`000,0,60000,0,153);
fill (180,sat1,360,100);
rect (1000,0,200,600);
fill (180,sat2,360,100);
rect (800,0,200,600);
}
As you can see above, the level of saturation is controlled by the millisecond. In the furthest right rectangle it takes 10 seconds to travel through the saturation. The next one in takes 60 seconds, and they both re-loop.
My intention is to make a digital clock, but instead of using numbers, i would like to use saturation of color, most saturated corresponding to the number 9, and white corresponding to the number 0.
The screen at present just shows 2 active sections, which will become 6, referencing the HH:MM:SS of a digital clock.
I was wondering if it was possible to use the clock on the computer which views this visualization to control the saturation levels in real time?
Does anybody have advice or suggestion of code i can look at in order to achieve this?
Thank you,
1