xxxxxxxxxx
49
let t = 0
let splats = []
class Splat {
constructor() {
this.t = 0;
this.pos = createVector(randomGaussian(mouseX), randomGaussian(mouseY));
this.r = 10;
}
show() {
fill(255)
circle(this.pos.x, this.pos.y, this.r)
}
update() {
this.t++;
if (splats[this.t] > 30) {
splice(splats, i )
}
}
} // splat
function paint() {
if (mouseIsPressed) {
splats.push(new Splat())
}
}
function setup() {
createCanvas(400, 800);
background(40);
}
function draw() {
t++
paint()
for (var i = 0; i < splats.length; i ++ ) {
splats[i].update();
splats[i].show();
}
}