Last active
August 29, 2015 14:02
-
-
Save lmccart/a032b6e6dbd737490e4f to your computer and use it in GitHub Desktop.
dom example
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 c; | |
| var t; | |
| var i; | |
| function setup() { | |
| c = createCanvas(800, 600); | |
| var n = document.getElementById('test'); | |
| c.parent(n); | |
| c.position(100, 100); | |
| c.id('myc'); | |
| c.size(100, 100); | |
| i = p5DOM.createImg("https://avatars1.githubusercontent.com/u/191056?s=460", "alt_text"); | |
| i.position(0, 0); | |
| i.size(100, AUTO); | |
| t = p5DOM.createDiv("hi"); | |
| t.position(0, 0); | |
| p5DOM.createA("http://lauren-mccarthy.com", "this is a link", "_blank"); | |
| p5DOM.createH1("h1"); | |
| p5DOM.createH2("h2"); | |
| p5DOM.createH3("h3"); | |
| p5DOM.createH4("h4"); | |
| p5DOM.createH5("h5"); | |
| } | |
| function draw() { | |
| background(95, 65, 26); | |
| }; | |
| function mousePressed() { | |
| console.log('hi') | |
| var can = p5DOM.getElement('myc'); | |
| can.position(10, 10); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment