fractalkitty looking for math? fractalkitty.com

all

Peace

#trig

strands

let t;
let v = [];
function setup() {
  createCanvas(600, 400);
  c1 = color(255, 245, 59, 255);
  c2 = color(22, 73, 235, 2255);
  noStroke();
  background(255);
  angleMode(DEGREES);
}
function draw() {
  translate(0, height / 2);
  t = 360 * sin(frameCount / 100);
  strands(1000, height / 2);
  stroke(255, 255, 255, 10);
  strokeWeight(20);
  noFill();
  circle(width / 2, 0, 200);
  line(width / 2, 100, width / 2, -100);
  line(width / 2, 0, width / 2 + 100 * cos(135), 100 * sin(135));
  line(width / 2, 0, width / 2 - 100 * cos(135), 100 * sin(135));
  if (t > 150) {
    stroke(255);
    circle(width / 2, 0, 200);
    line(width / 2, 100, width / 2, -100);
    line(width / 2, 0, width / 2 + 100 * cos(135), 100 * sin(135));
    line(width / 2, 0, width / 2 - 100 * cos(135), 100 * sin(135));
    noLoop();
  }
}

function strands(d, r) {
  stroke(c1);
  strokeWeight(0.5);
  noFill();
  for (let i = 0; i < width; i += 0.5) {
    x = i;
    y = r * sin(137.5 * i - t);

    if (y <= 0) {
      stroke(c2);
    } else {
      stroke(c1);
    }
    if (t < -350) {
      stroke(255);
    }

    circle(x, y, 1);
  }
}