xxxxxxxxxx
let n
let center
function createPoint(n,radius) {
let theta = 2.39996*n;
let r=sqrt(n) * radius;
let v = createVector(r*sin(theta),r*cos(theta));
v.add(center)
return v
}
function setup() {
createCanvas(windowWidth, windowHeight);
center = createVector(windowWidth * 0.5,windowHeight * 0.5)
colorMode(HSB)
background(100);
n = 0
}
function draw() {
n += 1
m = n + random(200)
let a = createPoint(m,10)
let b = createPoint(m+1,10)
let c = createPoint(m-1,10)
if (n%3 == 0) {
let col = color(0,0, 100)
col.setAlpha(0.05)
noStroke();
fill(col)
}
else {
let hue = n % 360
let col = color(hue,50 + random(50), 50 + random(50));
col.setAlpha(0.2)
stroke(col)
noFill()
}
triangle(a.x,a.y,b.x,b.y,c.x,c.y)
if(n>1000) {
n = 0
}
}