Index / 2017 / Get Colour Buttons
600×400 · p5.js instance mode
Get_Colour_Buttons.pde 34 lines
/*

Useful Reference - Using colour for hit detection
03/01/2017

*/

color cm, c1;

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

  c1 = #FF3434;
}

void draw() {
  cm = get(mouseX, mouseY);
  
  background(#FFFFFF);
  
  noStroke();
  fill(#FF3434);
  triangle(300,150,400,300,200,300);
  
  fill(#B71E1E);
  textAlign(CENTER);
  textSize(36);
  
  if (cm == c1) {
    text("Found me!", width/2, height/2 - 100);
  } else {
    text("Where am I?", width/2, height/2 - 100);
  }
}
read-only archive source from /2017/Useful References/Get_Colour_Buttons/Get_Colour_Buttons.pde

Description

This page is generated from the Processing project folder at /2017/Useful References/Get_Colour_Buttons/Get_Colour_Buttons.pde.

Archive

No companion assets were found in this sketch folder.