1 lines, no comments ยท 3,113 tokens, written in 13 seconds for $0.028


1  let particles=[];const numParticles=800;const noiseScale=0.01;function setup(){createCanvas(windowWidth,windowHeight);background(10);for(let i=0;i<numParticles;i++){particles.push(new Particle(random(width),random(height)));}}function draw(){fill(10,10,10,15);rect(0,0,width,height);for(let p of particles){p.update();p.show();}}class Particle{constructor(x,y){this.pos=createVector(x,y);this.vel=createVector(0,0);this.acc=createVector(0,0);this.maxSpeed=random(1,3);this.color=color(random(100,255),random(100,200),255,150);}update(){let angle=noise(this.pos.x*noiseScale,this.pos.y*noiseScale,frameCount*0.002)*TWO_PI*2;let force=p5.Vector.fromAngle(angle);force.mult(0.1);if(mouseIsPressed){let mousePos=createVector(mouseX,mouseY);let dir=p5.Vector.sub(mousePos,this.pos);let d=dir.mag();if(d<200){dir.setMag((200-d)*0.01);force.add(dir);}}this.acc.add(force);this.vel.add(this.acc);this.vel.limit(this.maxSpeed);this.pos.add(this.vel);this.acc.mult(0);if(this.pos.x<0||this.pos.x>width||this.pos.y<0||this.pos.y>height){this.pos.set(random(width),random(height));this.vel.mult(0);}}show(){stroke(this.color);strokeWeight(1.5);point(this.pos.x,this.pos.y);}}function windowResized(){resizeCanvas(windowWidth,windowHeight);background(10);}