Skip to content

Instantly share code, notes, and snippets.

@mimetaur
Created October 31, 2019 21:30
Show Gist options
  • Save mimetaur/4f45903adffba1736b16e8303f3e9ab7 to your computer and use it in GitHub Desktop.
Save mimetaur/4f45903adffba1736b16e8303f3e9ab7 to your computer and use it in GitHub Desktop.
Code 1 2019 - Week 5 Sketch 2 Suggestion
let dark = 20;
let light = 180;
function setup() {
createCanvas(400, 400);
fill(200, 100, 0);
}
function draw() {
fill(light);
background(255);
drawButton(200, 200, 200, 100, 10);
}
function drawButton(x, y, w, h, r) {
rectMode(CENTER);
rect(x, y, w, h, 10);
// line 24 is your problem - you are going to need
// mouseX, mouseY, and mouseIsPressed, as well as knowing
// the x,y, width, and height of your button
// for this exercise, you don't need any other functions, you
// can do it all in draw
if ( true ) {
fill(dark);
} else {
fill(light);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment