let x = 300;
let y = 300;
let extraCanvas;
function setup() {
createCanvas(600, 600);
extraCanvas = createGraphics(600, 600);
extraCanvas.clear();
background(255, 0, 0);
frameRate(20);
}
function draw() {
background(255, 0, 0);
x += random(-20, 20);
y += random(-20, 20);
// the dots that pop up random location
extraCanvas.fill(80, 120, 255);
extraCanvas.stroke(45, 220, 160);
let dotX = random(width);
let dotY = random(height);
extraCanvas.ellipse(dotX, dotY, 50, 50);
// trailing mouse ellipse
extraCanvas.fill(255, 100, 100, 100);
extraCanvas.stroke(100, 100, 255);
extraCanvas.ellipse(mouseX, mouseY, 100, 60);
image(extraCanvas, 0, 0);
// the "vibrating" big spot (is in front of the extraCanvas)
fill(230, 80, 100);
stroke(160, 170, 200);
strokeWeight(4);
circle(x, y, 100, 100);
// contrast to the "vibrating" big spot being in same layer as the other circles that build up and don't disappear
// extraCanvas.fill(230, 80, 100);
// extraCanvas.stroke(160, 170, 200);
// extraCanvas.strokeWeight(4);
// extraCanvas.circle(x, y, 100, 100);
}
Categories