Example 1: Noise Drifters
Code
let pts = [];
function setup() {
createCanvas(400, 400);
for (let i = 0; i < 600; i++) pts.push(createVector(random(width), random(height)));
background(255);
}
function draw() {
noStroke();
fill(255, 255, 255, 20);
rect(0, 0, width, height);
stroke(255, 45, 140, 90);
for (let p of pts) {
let a = noise(p.x * 0.006, p.y * 0.006, frameCount * 0.003) * TAU * 2;
p.x += cos(a) * 1.2;
p.y += sin(a) * 1.2;
point(p.x, p.y);
if (p.x < 0 || p.x > width || p.y < 0 || p.y > height) {
p.set(random(width), random(height));
}
}
}Try this: Vary noise scale to switch between smooth and turbulent flow.