xxxxxxxxxx
36
//work on more later
const density = "Ñ@#W$9876543210?!abc;:+=-,._";
let emoji;
function preload(){
emoji = loadImage('https://static01.nyt.com/images/2021/09/30/fashion/29melting-face-emoji/29melting-face-emoji-mediumSquareAt3X-v2.jpg');
}
function setup() {
createCanvas(windowWidth, windowHeight);
}
function draw() {
background(220);
image(emoji, 0, 0, width, height);
let w = width / emoji.width;
let h = height / emoji.height;
emoji.loadPixels()
for(let i = 0; i < emoji.width; i++){
for(let j = 0; j < emoji.height; j++){
const pixelIndex = (i + j * emoji.width) * 16;
const r = emoji.pixels[pixelIndex + 0];
const g = emoji.pixels[pixelIndex + 1];
const b = emoji.pixels[pixelIndex + 2];
noStroke();
fill(r, g, b);
square(i * w, j * h, w)
}
}
}