xxxxxxxxxx
50
let x, y, t;
let r = 100;
let increment;
let amount = 2000;
function setup() {
createCanvas(500, 500);
background(220);
fill(0);
noStroke();
frameRate(30);
strokeWeight(2);
}
function draw() {
background(255);
rotate(PI/16);
translate(45, -45);
increment = TWO_PI / amount;
t = frameCount;
let k = 0;
let amp = map(sin(frameCount * 0.015 * 0.5), -1, 1, -10, 12);
let curve = map(sin(frameCount * 0.015 * 0.5), -1, 1, 0.99, 0.99);
for (let i = 0; i < TWO_PI - increment; i += increment) {
r = map(sin(i * 8), -1, 1, curve, 1) * amp;
x = cos(i) * r + 250;
y = sin(i) * r + 250;
// y = x * x;
if (k % 10 == 0) {
let j = i + 0.000000001;
let r2 = map(sin(j * 8), -1, 1, curve, 1) * amp;
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++;
}
// console.log(amp);
}