fractalkitty looking for math? fractalkitty.com

Genuary 2024

the gravity of thought

#trig#interactive#animation#wave#genuary

cModeborder

let cMode = 0;
let g = 9.81;
let a, c;
let nP = 20;
let nR = 10;
function setup() {
  createCanvas(windowWidth * 0.9, windowHeight * 0.9);
  rectMode(CENTER);
  c = min(width, height) / 2;
  a = -c / 3;
}

function draw() {
  background(10, 30, 40);
  translate(width / 2, height / 2);
  t = frameCount / 50;

  stroke(255, 255, 255, 100);
  strokeWeight(2);

  for (let k = 0; k < nR; k++) {
    push();
    rotate((TWO_PI / nR) * k);
    cnt = 0;
    for (let i = 0.9; i <= 7; i += 1) {
      for (let j = 1; j <= nP; j++) {
        push();
        strokeWeight(0.15);
        L = c / 2 - min(c / 2, 2 * i);
        T = TWO_PI * sqrt(L / g);
        theta0 = (PI / nP) * j;
        A = theta0 * cos(sqrt(g / L) * t);
        x = L * sin(A);
        y = L * cos(A);
        scale(1 / (i * sqrt(i)), 1 / (i * sqrt(i)));
        noFill();
        stroke(255 - i * 50, 255 - i * 5, 255, 150);
        line(0, 0, x, -c / 4 + y);
        line(0, 0, -x, -c / 4 + y);
        noStroke();
        fill(255 - i * 50, 255 - i * 5, 255, 150);
        s = c / 20;
        circle(x, -c / 4 + y, s);
        circle(-x, -c / 4 + y, s);

        pop();
      }
    }
    pop();
  }

  border();
}

function border() {
  noFill();
  stroke(20, 50, 60);
  strokeWeight(4);
  rect(0, 0, width - 20, height - 20);
}

function mousePressed() {
  if (nR < 10) {
    nR++;
  } else {
    nR = 1;
  }
}

function keyPressed() {}

function windowResized() {
  resizeCanvas(windowWidth * 0.9, windowHeight * 0.9);
}