xxxxxxxxxx
80
let a1 = 0;
let a2 = 0;
let x = [];
let y = [];
let cr = [];
let amp = 15;
let pts = amp * 20;
let period = 15;
let degree = 360;
let xoff = 0;
let yoff = 0;
function setup() {
createCanvas(windowWidth, windowHeight);
angleMode(DEGREES);
colorMode(HSB);
}
function draw() {
background(0, 0.05);
let nMap1 = map(noise(xoff, yoff), -1, 1, 250, 50);
let nMap2 = map(noise(xoff, yoff), 0, 1, 50, 250);
translate(width / 2, height / 2);
push();
rotate(a1);
circlePoints(nMap1, nMap1, 1);
pop();
push();
rotate(a2);
circlePoints(nMap2, nMap2, 1);
pop();
push();
rotate(a1);
circlePoints(nMap2, nMap1, 2);
pop();
push();
rotate(a2);
circlePoints(nMap1, nMap2, 1);
pop();
push();
rotate(a1);
circlePoints(nMap2 * 1.5, nMap1, 3);
pop();
push();
rotate(a2);
circlePoints(nMap1 * 1.5, nMap2, 1);
pop();
xoff += 0.005;
yoff += 0.007;
a1 += 0.5;
a2 -= 0.5;
}
function circlePoints(r, n, s) {
beginShape(POINTS);
for (let i = 0; i <= pts; i++) {
let angle = (i / pts) * degree;
cr = amp * cos(angle * period + n);
x[i] = (r + cr) * cos(angle);
y[i] = (r + cr) * sin(angle);
noFill();
strokeWeight(s);
stroke(n);
vertex(x[i], y[i]);
}
endShape();
}