Lynda | Processing Tutorials

Today Ive been doing more work on variables and mouse tracking. Im still trying to get my head around variables, I get the simple stuff its just the divides and “Int” commands that are defeating me, thats next on my list!
Using I have been able to code a simple mouse tracking programme off by heart (I promise!). This programme simply allows you to draw lines with rectangular pivots with NO background reset. is proving a massive help to me with this type of coding, there are over 7 hours of tutorials which includes a lot more than Ive covered as of yet.

Below is the programme I created:

void setup(){
  size(600, 600);

void draw(){
  fill(220, 0, 0);
  rect(mouseX, mouseY, 10, 10);
  rect(pmouseX, pmouseY, 10, 10);
  line(mouseX, mouseY, pmouseX, pmouseY);

This program draws continuously with the background being redrawn each frame. A square is drawn at the location of the mouse 8 times a second according to the frame rate. A line is also drawn in relation to the mouse cursors location. In the future I will be looking at more complex code which involve variables and other functions.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s