fractalkitty looking for math? fractalkitty.com

Genuary 2024

<1KB

#random#trig#genuary

setup = () => {
  createCanvas(windowWidth, windowHeight);
  rectMode(CENTER);
  noFill();
  a = random(width / 3, width / 2);
  b = random(width / 3, width / 2);
  c = random(10, 20);
  d = random(2, 12)
};
draw = () => {
  background(10, 30, 40, 2);
  translate(width / 2, height / 2);
  t = frameCount / 1500;
  strokeWeight(1);
  for (let k = 0; k < d; k++) {
    push();
    rotate(TWO_PI / (int(d)) * k);
    for (let i = 0; i <= c; i++) {
      for (let j = 0; j < 39; j += 1) {
        push();
        stroke(155 + c * d - i * c, 255 - j * d * 2, 255 - i * d / 2, 100);
        translate(a / 2 * sin(TWO_PI / c * j + t - b * sin(t / 100)), b / 4 * cos(TWO_PI / c * j + t - b * cos(t / 100)));
        rotate(TWO_PI / c * j + t);
        line(0, 0, c / 4 * sin(TWO_PI / c * j), a * cos(TWO_PI / c * j));
        pop()
      }
    }
    pop();
  };
  stroke(20, 50, 60);
  strokeWeight(4);
  rect(0, 0, width - 20, height - 20)
};
mousePressed = () => {
  setup();
  draw();
}