fractalkitty looking for math? fractalkitty.com

Genuary 2022

ditheringMe

#random#image#interactive#study#genuary

cArray

let t = 0;
let s;
let cArray = [];
let cnt = 0;
let d = 3;
function preload() {
  me = loadImage("/assets/IMG_7184.JPG");
}
function setup() {
  noLoop();
  c = 500;
  noStroke();
  x = me.width / me.height;
  cnv = createCanvas(c, c / x);
  s = [];
}

function draw() {
  image(me, 0, 0, width, height);
  if (frameCount % 20 != 0) {
    sum1 = 0;
    for (let i = 0; i < width; i += 1) {
      for (let j = 0; j < height; j += 1) {
        tmp = get(i, j);
        sum1 = sum1 + tmp[0] + tmp[1] + tmp[2];
        if (i % 3 === 0 && (j % 3 === 0) & ((i !== 0 % j) !== 0)) {
          if (sum1 < 600) {
            fill(0);
            rect(i - 3, j - 3, 3, 3);
            if (i % int(random(0, 3)) === 0 && j % int(random(0, 3)) === 0) {
              fill(255);
              rect(i - 3, j - 3, 0.5, 0.5);
            }
          }
          if (sum1 >= 600 && sum1 < 1300) {
            fill(0);
            rect(i - 3, j - 3, 3, 3);
            if (i % int(random(0, 3)) === 0 && j % int(random(0, 3)) === 0) {
              fill(255);
              rect(i - 3, j - 3, 2, 2);
            }
          }
          if (sum1 >= 1300 && sum1 < 1700) {
            fill(255);
            rect(i - 3, j - 3, 3, 3);
            if (i % int(random(0, 3)) === 0 && j % int(random(0, 3)) === 0) {
              fill(0);
              rect(i - 3, j - 3, 2, 2);
            }
          }
          if (sum1 >= 1700 && sum1 < 2100) {
            fill(255);
            rect(i - 3, j - 3, 3, 3);
            if (i % int(random(0, 3)) === 0 && j % int(random(0, 3)) === 0) {
              fill(0);
              rect(i - 3, j - 3, 1.5, 1.5);
            }
          }
          if (sum1 >= 2100 && sum1 < 2500) {
            fill(255);
            rect(i - 3, j - 3, 3, 3);
            if (i % int(random(0, 3)) === 0 && j % int(random(0, 3)) === 0) {
              fill(0);
              rect(i - 3, j - 3, 0.5, 0.5);
            }
          }
          if (sum1 >= 2500 && sum1 < 2900) {
            fill(255);
            rect(i - 3, j - 3, 3, 3);
            if (i % int(random(0, 7)) === 0 && j % int(random(0, 7)) === 0) {
              fill(0);
              rect(i - 3, j - 3, 0.5, 0.5);
            }
          }
          if (sum1 >= 2900) {
            fill(255);
            rect(i - 3, j - 3, 3, 3);
            if (i % int(random(0, 7)) === 0 && j % int(random(0, 7)) === 0) {
              fill(0);
              rect(i - 3, j - 3, 0.2, 0.2);
            }
          }
          sum1 = 0;
          s[0] = [];
          s[1] = [];
          s[2] = [];
        }
      }
    }
  }
  fill(255);
  rect(0, 0, width, 3);
  rect(0, 0, 3, height);
  rect(width - 3, 0, 3, height);
  rect(0, height - 3, width, 3);
}
function keyPressed() {
  save(cnv, "mether", "jpg");
}