xxxxxxxxxx
29
/*
keyIsPressed is a built-in Boolean variable.
Boolean means only reports the values true or false.
*/
function setup() {
createCanvas(400, 400)
}
function draw() {
background(220)
fill(255)//white
//change fill if any key is pressed
if (keyIsPressed && key == "d") {
fill(0)//black
}
rect(25, 25, 50, 50)
//check out the value of the keyIsPressed variable in the console
//console.log(key)
console.log(key)
}//end draw