Particle[] dots = new Particle[350];
for (int i = 0; i < dots.length; i++) {
float r = radius + (random(thickness) - thickness/2);
float v = random(velMin, velMax);
if (random(1) > .5) v *= -1;
dots[i] = new Particle(r, v);
translate(width/2, height/2);
for (int i = 0; i < dots.length; i++) {
for (int i = 0; i < dots.length; i++) {
for (int j = i + 1; j < dots.length; j++) {
float d = dist(dots[i].pos.x, dots[i].pos.y, dots[j].pos.x, dots[j].pos.y);
if (d < distance && i != j) {
for (int k = j + 1; k < dots.length; k++) {
float d1 = dist(dots[j].pos.x, dots[j].pos.y, dots[k].pos.x, dots[k].pos.y);
float d2 = dist(dots[i].pos.x, dots[i].pos.y, dots[k].pos.x, dots[k].pos.y);
if (d1 < distance && d2 < distance) {
vertex(dots[i].pos.x, dots[i].pos.y);
vertex(dots[j].pos.x, dots[j].pos.y);
vertex(dots[k].pos.x, dots[k].pos.y);
float radius, vel, angle;
PVector pos = new PVector();
Particle(float r, float v) {
if (random(1) > 0.5) rgb = lerpColor(#FF0051, #FF0001, random(1));
else rgb = lerpColor(#FF0000, #FF9100, random(1));
pos.x = cos(angle) * radius;
pos.y = sin(angle) * radius;