xxxxxxxxxx
// By Roni Kaufman
// Inspired by Sol LeWitt's "Squiggly Brushstrokes"
let particles = [];
let n = 1000;
let colors;
let squiggliness = 1/800;
function setup() {
createCanvas(1500, 2500);
//colorMode(HSB, 100);
noStroke();
let alpha = 25;
colors = [color(0, 255, 187, alpha), color(179, 222, 147, alpha), color(1, 80, 97, alpha), color(53, 227, 241, alpha), color(115, 78, 164, alpha)];
background(29, 35, 61);
updateParticles();
setInterval(updateParticles, 2500);
}
function draw() {
for (let p of particles) {
p.draw();
p.move();
}
}
function updateParticles() {
particles = [];
for (let i = 0; i < n; i++) {
let x_ = random(-50, width + 50);
let y_ = random(-50, height + 50);
let s_ = 0.5;
let c_ = random(colors);
particles.push(new Particle(x_, y_, s_, c_));
}
}
function Particle(x_, y_, s_, c_) {
this.x = x_;
this.y = y_;
this.size = s_;
this.c = c_;
this.dist = 0.5;
this.move = function() {
let theta = noise(this.x * squiggliness, this.y * squiggliness)*PI*4;
let v = p5.Vector.fromAngle(theta, this.dist);
this.x += v.x;
this.y += v.y;
//this.dist *= 0.9999;
//this.alpha *= 0.99;
}
this.draw = function() {
fill(this.c);
circle(this.x, this.y, this.size);
}
}