//specify list of colors to color points
listOfColors = [255];
let cX = cY = L = V = 250;
function setup() {
createCanvas(500, 500);
r = 200;
segs = [];
segsW = [];
segsC = [];
for (l = 0; l < L + 1; l++) {
row = [];
rowW = [];
rowC = [];
for (s = 1; s < V + 1; s++) {
if (random(1) > 0.65) {
row.push(1);
} else {
row.push(0);
}
rowW.push(random(0.1, 1.9));
rowC.push(random(listOfColors));
}
segs.push(row);
segsW.push(rowW);
segsC.push(rowC);
}
}
function draw() {
background(0);
noFill();
for (l = 0; l < L + 1; l++) {
// get distance between two points
var len = sqrt(
pow(r * cos((PI / L) * l) - r * cos((-PI / L) * l), 2) +
pow(r * sin((PI / L) * l) - r * sin((-PI / L) * l), 2)
);
for (s = 1; s < V + 1; s++) {
var n = noise(
(cX + r * cos((PI / L) * l)) * 0.2 + millis() / 2000,
(cY + r * sin((PI / L) * l) * 0.2 - (len / V) * s) * 0.0002 +
millis() / 3000
);
n = map(n, 0, 1, -30, 30);
if (s == 0 || s == V) {n = 0}
point(
cX + r * cos((PI / L) * l) + n,
cY + r * sin((PI / L) * l) - (len / V) * s + n
);
if (segs[l][s]) {
strokeWeight(segsW[l][s]);
stroke(segsC[l][s]);
}
}
point(cX + r * cos((-PI / L) * l), cY + r * sin((-PI / L) * l));
}
noLoop();
}