xxxxxxxxxx
24
/*
* Creative Coding Workshop #1 Demo - Press to Draw Radom Circles at Mouse Position
*
* Jack B. Du (github@jackbdu.com)
*/
function setup() {
// create a 400px by 400px canvas
createCanvas(400, 400);
// set framerate to 60 (60 frames per second)
frameRate(60);
// specify a background (on top of which all circles will be drawn)
background(60, 189, 92);
}
function draw() {
// only if the primary button of mouse is pressed
if (mouseIsPressed) {
// set fill color to a random color
fill(random(255), random(255), random(255));
// draw a circle of a random diameter at the mouse location
circle(mouseX, mouseY, random(20, 50));
}
}