let count = 1000; var particles_a = []; var particles_b = []; var particles_c = []; var fade = 200; var radius = 3; const w = window.innerWidth; const h = 600; let noiseScale = 10; let noiseStrength = 1.2; function setup() { createCanvas(windowWidth, windowHeight); noStroke(); for (let i=0; i width || this.loc.y < 0 || this.loc.y > height) { this.loc.x = random(w) + windowWidth*0.5 - w*0.5; this.loc.y = random(h) + windowHeight*0.5 - h*0.5; } } Particle.prototype.move = function() { this.angle = noise(this.loc.x/noiseScale, this.loc.y/noiseScale, frameCount/noiseScale) * TWO_PI*noiseStrength; this.dir.x = cos(this.angle) + sin(this.angle) - sin(this.angle); this.dir.y = sin(this.angle) - cos(this.angle)*sin(this.angle); this.vel = this.dir.copy(); this.vel.mult(this.speed*this.d); this.loc.add(this.vel); }