Draw a line without knowing the end point or from how many points it's composed of.

I want to Draw a line without knowing the end point or from how many points it’s composed of. In this case i can’t use delta x or maxnbpoints and a counter. I want the program to draw a line from my first touch location until touchstate ends. Moreover, i want the user to be able to lift up his finger and countinue without losing the previous drawn lines.

Can anyone be of anyhelp??

if you have one point but not the second it works

here (x1,y1) is not in the screen

-- Test Infinite Line

function setup()

function draw()
    background(40, 40, 50)
    strokeWidth(5) ; fill(49, 255, 0, 255)

Now I understand!

There have been quite a few posts about this, when people try to make a drawing program, where you can draw lines with your finger.

For example




If you search on “drawing program” in the search box at the top right of screen, you may find more examples.

Thank you both @Ignatz and @hpsoft… I will try them and let you know

@Ignatz i used the first link you sent me : “http://codea.io/talk/discussion/comment/531
I altered one thing so it can be used on my code. Instead of defining red green blue and alpha i defined a variable colorfill because the colour changes when you hit a certain button… The code is running with no error.

But it seems it lost its capacity to keep the line drawn on the figure.
can you help?