Created
October 31, 2019 21:30
-
-
Save mimetaur/4f45903adffba1736b16e8303f3e9ab7 to your computer and use it in GitHub Desktop.
Code 1 2019 - Week 5 Sketch 2 Suggestion
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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