matthewalangreen
9/20/2018 - 8:04 PM

movingRectangle

// Goal: make a red rectangle that starts in the middle of the screen
// and moves when I move the mouse


void setup() {
  size(600,600); // Make a canvas that's 600 x 600 pixels
  background(255); // paint the background of the canvas white
  rectMode(CENTER); // make it so I'm tracking a rectangle's position by its center point
}


void draw() {
  background(255); // paint the background white
  fill(255,0,0); // choose red fill color
  //rect(width/2, height/2, 50, 50); // draw rect in middle of screen?
  rect(mouseX, mouseY, 50, 50);
 
}