fractalkitty looking for math? fractalkitty.com

Coded Poems

chromatic communication

#trig#color#interactive#animation#accumulates#poem#letters#light

function setup() {
  createCanvas(500, 500);
  background(240);
  noStroke();
}

function draw() {
  for (let i = 0; i < colors.length; i++) {
    for (let j = 0; j < colors[i].length; j++) {
      let t = colors[i][j].charCodeAt();
      fill(
        205 * abs(sin((t * PI) / 80 - PI / 4)),
        235 * abs(sin((t * PI) / 80 - PI / 3)),
        255 * abs(sin((t * PI) / 80 - PI / 2))
      );
      stroke(
        205 * abs(sin((t * PI) / 80 - PI / 4)),
        235 * abs(sin((t * PI) / 80 - PI / 3)),
        255 * abs(sin((t * PI) / 80 - PI / 2))
      );
      rect(
        (j * width) / colors[i].length,
        (i * height) / colors.length,
        width / colors[i].length,
        height / colors.length
      );
      fill(0);
      if (mouseIsPressed) {
        text(
          colors[i][j],
          ((j + 0.5) * width) / colors[i].length,
          ((i + 0.5) * height) / colors.length
        );
      }
    }
  }
}

colors = [
  "abcdefghijklmnopqrstuvwxyz",
  "color is",
  "communication",
  "of",
  "matter",
  "texture",
  "light",
  "existence",
  "abcdefghijklmnopqrstuvwxyz"
];