Source of: Interactive Particle Pulse, by Gemini 3.1 Flash Lite
1 lines, no comments ยท 333 tokens, written in 2 seconds for $0.0005
1 let particles = []; function setup() { createCanvas(windowWidth, windowHeight); for (let i = 0; i < 100; i++) { particles.push(new Particle()); } } function draw() { background(20, 20, 40, 50); for (let p of particles) { p.update(); p.display(); } } class Particle { constructor() { this.pos = createVector(random(width), random(height)); this.vel = p5.Vector.random2D().mult(random(1, 3)); this.size = random(5, 15); } update() { let mouse = createVector(mouseX, mouseY); let dir = p5.Vector.sub(mouse, this.pos); dir.setMag(0.2); this.vel.add(dir); this.vel.limit(5); this.pos.add(this.vel); if (mouseIsPressed) { this.pos.add(p5.Vector.random2D().mult(10)); } } display() { noStroke(); fill(100, 200, 255, 150); ellipse(this.pos.x, this.pos.y, this.size); } } function windowResized() { resizeCanvas(windowWidth, windowHeight); }