Created
April 23, 2020 19:28
-
-
Save nickgs/7b473dc91b9d225bb0e1411594cf7a91 to your computer and use it in GitHub Desktop.
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 value = 0; | |
let pad1; | |
let pad2; | |
function setup() { | |
createCanvas(windowWidth, windowHeight); | |
background("black"); | |
pad1 = new Pad(10, 10); | |
pad2 = new Pad(250, 250); | |
} | |
function draw() { | |
pad1.draw(); | |
pad2.draw(); | |
} | |
function keyPressed() { | |
if(keyCode == 68) { | |
value = random(255); | |
} | |
} | |
class Pad { | |
constructor(x, y) { | |
this.x = x; | |
this.y = y; | |
} | |
draw() { | |
rect(this.x, this.y, 25, 25); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment