Created
January 8, 2015 10:17
-
-
Save shiffman/7b2cfbfc1706dd203f9c to your computer and use it in GitHub Desktop.
DOM Sample p5
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
| var canvas; | |
| var button; | |
| function setup() { | |
| // Make a canvas | |
| canvas = createCanvas(100,100); | |
| // Make an HTML DOM element, a button! | |
| // The button will have the word "submit" in it | |
| button = createButton("submit"); | |
| // Set the position in the browser window (separate from the canvas) | |
| button.position(10,120); | |
| // The function "makeItRed" is a callback for | |
| // when the button is pressed | |
| button.mousePressed(makeItRed); | |
| background(0); | |
| } | |
| function makeItRed() { | |
| background(255,0,0); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment