fractalkitty looking for math? fractalkitty.com

early works

deltoidFlex

#trig#interactive#animation#math#parametric

deltoid

let a,
  g,
  n,
  f = 255;
let p = 0;
function setup() {
  createCanvas(windowWidth, windowHeight - 20);
  angleMode(DEGREES);
  n = 17;
  a = width / n / 1.7;
  g = width / 3 / n;
  noStroke();
}

function draw() {
  background(f, f, f, 150);
  fill(255 - f);
  translate(width / 2, height / 2);
  t = 360 * sin(frameCount / 20);
  for (k = 0; k <= n + 5; k++) {
    for (j = 0; j <= n + 5; j++) {
      rotate(p / 100);
      push();
      translate(width / 1.5 - (j * width) / n, height / 2 - (k * height) / n);
      rotate(j * t - k * t + t / 2);

      deltoid();
      pop();
    }
  }
}

function deltoid() {
  beginShape();
  for (let i = 0; i < 360; i++) {
    x = a * ((2 * cos(i)) / 3 + cos(2 * i) / 3);
    y = a * ((2 * sin(i)) / 3 - sin(2 * i) / 3);
    vertex(x, y);
  }
  endShape(CLOSE);
}

function keyPressed() {
  if (keyCode === 38) {
    a = a + 3;
  } else if (keyCode === 40) {
    a = a - 3;
  } else if (keyCode === 37) {
    p = p + 1;
  } else if (keyCode === 39) {
    p = p - 1;
  } else if (keyCode == 32) {
    p = 0;
    a = width / n / 1.8;
  }
}

function mousePressed() {
  if (f === 0) {
    f = 255;
  } else {
    f = 0;
  }
}