xxxxxxxxxx
58
let spaceMono;
let video;
let grid = 10;
function preload() {
spaceMono = loadFont('assets/SpaceMono-Regular.ttf');
video = createVideo(['assets/woman.mp4']);
}
function setImage(cols, rows) {
video.size(cols, rows);
}
function setup() {
createCanvas(500, 500, /*SVG*/);
textFont(spaceMono);
textAlign(CENTER, CENTER);
colorMode(HSB,255);
setImage(grid, grid);
}
function draw() {
//noLoop();
newGrid();
//save("test.svg");
}
function newGrid() {
background(100);
fill(255);
let tx = grid;
let ty = grid;
let tw = width / tx;
let th = (height / ty);
//image(video, 0, 0);
translate(tw / 2, th / 2);
for (let x = 0; x < tx; x++) {
for (let y = 0; y < ty; y++) {
let c = video.get(x, y);
let selector = int(random(5));/*int(map(brightness(c), 0, 255, 0,5))*/
let size = map(brightness(c), 0, 255, 4,0);
textSize(size*4);
if (selector == 0) {
text('G', x * tw, y * th);
} else if (selector == 1) {
text('A', x * tw, y * th);
} else if (selector == 2) {
text('C', x * tw, y * th);
} else if (selector == 3) {
text('T', x * tw, y * th);
} else {
text('*', x * tw, y * th);
}
//text(‘g’, x*tw, y*th);
//ellipse(x*tw, y*th, tw, th);
}
}
}