xxxxxxxxxx
44
// A simple drawing app created live with HCID521 class
//
// Try using this with the MakeCode + CPX program:
// https://makecode.com/_gfE7HFXMPJJF
//
// For a version with sound, try:
// https://editor.p5js.org/jonfroehlich/sketches/qrU2WJIzJ
//
// By Jon Froehlich
// @jonfroehlich
// http://makeabilitylab.io
//
let hueVal = 0;
function setup() {
createCanvas(800, 600);
background(20);
colorMode(HSB);
noStroke();
}
function draw() {
// set the diameter of the circle based on the distance
// between the previous mouse points and current mouse points
let diameter = dist(mouseX, mouseY, pmouseX, pmouseY);
if(mouseIsPressed == true){
fill(hueVal, 100, 100, 0.5);
circle(mouseX, mouseY, diameter);
hueVal = hueVal + 1;
}
if(hueVal > 360){
hueVal = 0;
}
}
function keyPressed(){
background(20);
}