Loading...
Logo
Processing Forum

Draw a points line

in Programming Questions  •  3 years ago  
Hi friens, I want to draw a line with 3 points, but I need to draw the point 1, point 2 appears after 2 seconds and point 3 appears after 4 seconds.

How can I make it? Thanks in advance

Replies(6)

Not sure if it isnt easier, to just draw the 3 points by calculating the position and hardcode the coordinates.
But if it has to be flexible or much more points along a line. you can use lerp to do so:
http://processing.org/reference/lerp_.html
i think the actual task being set is the timing.

use millis() which will give you milliseconds from the start of the program. check them within your draw. if it's over the specified time draw the next point...

(not the best way of doing this from a programming point of view - lots of loops where you add nothing to the screen)
I have to draw points every 3 seconds. I'm using delay(3000) but my appears out of time, one at second 3, the next at second 2...and I don't know why my code doesn´t take delay(3000) every instruction.
don't use delay().. that's a common mistake.  kooogy is of course right: use millis() to time the events.  If you're not sure how, search the forum - this is something of a FAQ ;)
I want to draw a point, but it has been draw on an exactly instant time set up for me. (Example: in the second 7", in the second 13", in the second 15"). Is there any way to make it? Thank you very very much
post what you have and we'll have a look.