fractalkitty looking for math? fractalkitty.com

Genuary 2024

--. . -. ..- .- .-. -.--

#random#trig#text#interactive#animation#letters#genuary

bordergenuary


function setup() {
  cnv = createCanvas(windowWidth * 0.9, windowHeight * 0.9);
  c = min(width, height);
  rectMode(CENTER);
  angleMode(DEGREES);
  nRot = int(random(9, 20));
  r1 = random(50, 100);
  g1 = random(80, 110);
  b1 = random(100, 150);
  background(10, 30, 40);
}

function draw() {
  background(10, 30, 40, 2);

  translate(width / 2, height / 2);
  t = frameCount / 10;

  tmp = 1 * cos(t) * cos(t);
  fill(r1 * tmp, g1 * tmp, b1 * tmp);
  stroke(r1 * tmp, g1 * tmp, b1 * tmp);
  genuary();
  border();
}

function border() {
  push();
  noFill();
  stroke(20, 50, 60);
  strokeWeight(4);
  rect(0, 0, width - 20, height - 20);
  pop();
}
function genuary() {
  for (let g = 0; g < nRot; g++) {
    push();
    fill(30 + 100 * tmp, 60 + 180 * tmp, 90 + 165 * tmp);
    rotate((360 / nRot) * g - t);
    translate(0, c / 21 + (c / 21) * sin(t) + 360 / 7);
    rotate(t * 2);
    text("--. . -. ..- .- .-. -.--", 0, 0);
    pop();
  }
  for (let e = 0; e < nRot; e++) {
    push();
    rotate((360 / nRot) * e - t);
    translate(0, c / 15 + (c / 15) * sin(t) + (360 / 7) * 2);
    rotate(-t);
    text("--. . -. ..- .- .-. -.--", 0, 0);
    pop();
  }
  for (let n = 0; n < nRot; n++) {
    push();
    fill(30 + 100 * tmp, 60 + 180 * tmp, 90 + 165 * tmp);
    rotate((360 / nRot) * n - t);
    translate(0, c / 8 + (c / 8) * sin(t) + (360 / 7) * 3);
    rotate(t);
    text("--. . -. ..- .- .-. -.--", 0, 0);
    pop();
  }
  for (let u = 0; u < nRot; u++) {
    push();
    fill(30 + 100 * tmp, 60 + 180 * tmp, 90 + 165 * tmp);
    rotate((360 / nRot) * u - t);
    translate(0, c / 6 + (c / 6) * sin(t) + (360 / 7) * 4);
    rotate(-t * 2);
    text("--. . -. ..- .- .-. -.--", 0, 0);
    pop();
  }
  for (let a = 0; a < nRot; a++) {
    push();
    fill(30 + 100 * tmp, 60 + 180 * tmp, 90 + 165 * tmp);
    rotate((360 / nRot) * a - t + (360 / 7) * 5);
    translate(0, c / 5 + (c / 8) * sin(t));
    rotate(-t / 3);
    text("--. . -. ..- .- .-. -.--", 0, 0);
    pop();
  }
  for (let r = 0; r < nRot; r++) {
    push();
    fill(30 + 100 * tmp, 60 + 180 * tmp, 90 + 165 * tmp);
    rotate((360 / nRot) * r - t + (360 / 7) * 6);
    translate(0, c / 4.5 + (c / 4.5) * sin(t));
    rotate(t);
    text("--. . -. ..- .- .-. -.--", 0, 0);
    pop();
  }
  for (let y = 0; y < nRot; y++) {
    push();
    fill(30 + 100 * tmp, 60 + 180 * tmp, 90 + 165 * tmp);
    rotate((360 / nRot) * y - t);
    translate(0, c / 4 + (c / 4) * sin(t));
    rotate(-1.5 * t);
    text("--. . -. ..- .- .-. -.--", 0, 0);
    pop();
  }
}
function mousePressed() {
  frameCount = 0;
  setup();
  draw();
}

function keyPressed() {
  save(cnv, "--. . -. ..- .- .-. -.--", "jpg");
}

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