Interaction

Drawing a line

Point function makes the drawing a bit, well, pointy. We can make a smoother result usling line. Line function draws a line bitween two points. We get the current mouse position with mouseX and mouseY. Processing also has variables for the previous positions called pmouseX and pmouseY.

In the draw function I have used a mousePressed-variable and an if-statement. If-statement checks if the given condition is true and, if it is, executes the statements. Just like mouseX is a variable, Processing has a mousePressed-variable wich is true, if the mouse is pressed and otherwise false.