xxxxxxxxxx
41
// trip to Aarhus
const imgs = ['🎃','🍁','💀'];
let particles = [];
let bkgr;
function preload(){
bkgr = loadImage('aarhus.jpg');
}
function setup() {
createCanvas(600, 400);
}
function draw() {
background(color(248,235,229));
textSize(20);
fill("black");
noStroke();
text('Tap ... for Halloween 🎃🍁💀!',100,30);
image(bkgr,0,400-160);
for (let p of particles){
textSize(p.size);
text(p.img,p.x,p.y);
// update
if (p.y<395){
p.y += 1.2;
}
}
particles = particles.filter( p => (frameCount - p.born)<=30*20);
}
function mouseClicked(){
particles.push(
{img:imgs[~~random(3)],
size: ~~random(10,30),
x:mouseX-10 +~~random(-10,10),
y:mouseY,born:frameCount}
);
}