This bio-mask concept came to me during the height of the COVID-19 Pandemic.
var fungi = []; function setup() { createCanvas(windowWidth, windowHeight); background(0); frameRate(240); } function draw() { for (var i=0; i<fungi.length; i++) { fungi[i].update(); fungi[i].display(); } if (keyIsPressed) { background(0); } } function mouseDragged() { fungi.push(new Fungi(mouseX, mouseY)); }
//Fungi constructor function Fungi(x, y) { this.x = x; this.y = y; this.size = 1; this.lifetime = 10; this.display = function() { stroke (225, this.lifetime); noFill(); ellipse(this.x,this.y, this.size, this.size); } this.update = function() { this.x = this.x + random(-2,2); this.y = this.y + random(-2,2); //this.lifetime -- ; } }