We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hi there,
In our Graphic Design class we have to make a design for a clock in code. My idea requires me to make a shape (in my case an ellipse) change colour (red) for a very short amount of time, so it will appear flashing.
Working with the if command will not work in my case, for I need to make the ellipse flash red every ±0,215 seconds (215 ms), which means I'd have to write 300 individual commands for 1 minute for 1 light. I feel that this can be done much easier, but I can't find the proper command in the References Page.
Any help would be greatly appreciated!
Answers
Hi Armand,
there is a easier way to do this. with millis() you can get the number of milliseconds that passed since the programm started. in the draw loop you can then calculate the number of milliseconds that passed since the last time draw was called. with this information you could set the fill color to red for just the next frame (see first ellipse) or fill it with red according to the time span that has already passed (see second ellipse).
here a simple example: