xxxxxxxxxx
27
// Demonstrates how to use the CPX's mouse input as a paintbrush.
// - CPX Paint 2 adds in clear by receiving an "DELETE" key press
//
// This program is intended to be used with the CPX + MakeCode program:
// https://makecode.com/_awgTjpCrcKch
//
// By Jon E. Froehlich
// https://jonfroehlich.github.io/
let brushSize = 50;
function setup() {
createCanvas(400, 400);
background(220);
}
function draw() {
// background(220);
circle(mouseX, mouseY, brushSize);
}
function keyPressed() {
if(keyCode == DELETE){
print("DELETE key received, deleting canvas...")
background(220); // simply redraws the background on top of our painting
}
}