Last active
November 1, 2019 16:41
-
-
Save mimetaur/996da9e3eeb250091e23260f71dede97 to your computer and use it in GitHub Desktop.
Code 1 2019 - Week 5 Sketch #2 Solution 02 (Theresa)
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
function setup() { | |
createCanvas(400, 400); | |
} | |
function draw() { | |
background(255); | |
drawButton(100, 100, 200, 200); | |
if (mouseIsPressed && | |
mouseX > 100 && mouseX < 300 && | |
mouseY > 100 && mouseY < 300 ) { | |
fill(0, 255, 0); | |
} else { | |
fill(255, 0, 0); | |
} | |
print(mouseIsPressed); | |
} | |
function drawButton(x, y, w, h) { | |
rect(x, y, w, h, 10); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment