fractalkitty looking for math? fractalkitty.com

all

breathing shutter

#random#trig#animation

function setup() {
  createCanvas(windowWidth, windowHeight);
  background(20, 25, 40);
  d = min(width, height);
  stroke(200);
  noFill();
  angleMode(DEGREES);
  randies = [random(1, 2), random(1, 2)];
  strokeWeight(0.5);
  n = 50;
  console.log(randies);
}

function draw() {
  t = frameCount;
  background(20, 25, 40);
  translate(width / 2, height / 2);
  circle(0, 0, d / 1.5);

  for (let j = 0; j < n; j++) {
    r = 20;
    push();
    rotate((j * 360) / n);
    beginShape();
    for (let i = 0; i < d / 3 - (d / 3) * cos(t / 5); i++) {
      x = i + (d / 3) * cos(t / 5);
      y =
        r *
        sin(i * randies[0]) *
        cos(i * randies[1] + t / randies[0]) *
        cos(-t / randies[1]);
      vertex(x, y);
    }
    endShape();
    pop();
  }
}