Index / 2017 / Mousex Mousey IF Statements 01
№ 62

Mousex Mousey IF Statements 01

400×400 · p5.js instance mode
MouseX_MouseY_IF_Statements_01.pde 27 lines
/*

02/09/2017
mouseX, mouseY, if statements

*/

void setup() {
  size(400, 400);
  smooth();
  noStroke();
  frameRate(120);
  rectMode(CENTER);
  background(#EDEDED);
}

void draw() {
  if (mouseX <= width/2 && mouseY <= height/2) {
    background(#FFFFFF);
  } else if (mouseX >= width/2 && mouseY <= height/2) {
    background(#242424);
  } else if (mouseX <= width/2 && mouseY >= height/2) {
    background(#);
  } else {
    background(#FF3131);
  }
}
read-only archive source from /2017/Lessons/MouseX_MouseY_IF_Statements_01/MouseX_MouseY_IF_Statements_01.pde