xxxxxxxxxx
52
let x, y, t;
let r = 100;
let increment;
let amount = 2000;
function setup() {
createCanvas(500, 500);
background(220);
fill(0);
// noStroke();
stroke(50, 0, 15);
stroke(0);
frameRate(30);
strokeWeight(0.75);
}
function draw() {
// background(150, 250, 190);
background(230);
increment = TWO_PI / amount;
t = frameCount;
let k = 0;
let curve = map(sin(frameCount * 0.05), -1, 1, 0.99, 1.01);
beginShape();
for (let i = 0; i < TWO_PI; i += increment) {
r = map(sin(i * 3), -1, 1, curve, 1) * 1;
x = cos(i) * r + 250;
y = sin(i) * r + 250;
vertex(x, y);
// y = x * x;
if (k % 5 == 0) {
let j = i + increment;
let r2 = map(sin(j * 3), -1, 1, curve, 1) * 1;
let x2 = cos(j) * r2 + 250;
let y2 = sin(j) * r2 + 250;
// y2 =
// ellipse(x, y, 10);
// stroke(0);
let slope = (y2 - y) / (x2 - x);
let x0 = x - 1000;
let x3 = x2 + 1000;
let y0 = y - 1000 * slope;
let y3 = y2 + 1000 * slope;
line(x0, y0, x3, y3);
// noStroke();
}
// ellipse(x, y, 2);
k++;
}
endShape();
}