xxxxxxxxxx
let cap;
function setup() {
createCanvas(windowWidth, windowHeight);
cap = createCapture(VIDEO);
cap.hide();
}
function draw() {
background(240);
let ratio = max(width/cap.width,height/cap.height);
let lineHeight = height/20;
let lineSpan = 10;
for(let y = lineHeight; y <= height-lineHeight; y += lineHeight)
{
let pCol = 1;
for(let x = 0; x <width; x += lineSpan)
{
let cx = cap.width/2 - (-width/2+x)/ratio;
let cy = cap.height/2 - (height/2-y)/ratio;
let col = cap.get(cx,cy);
col = map(brightness(col),0,255,1,0);
col = pow(col,4);
let sw = map(col,1,0,lineHeight*0.5,0.01);
sw += (noise(x+frameCount/10000,y)- 0.5)*lineHeight*0.05;
let y1 = y + 30 * pCol;
let y2 = y + 30 * col;
strokeWeight(sw);
line(x, y1,x + lineSpan, y2);
pCol = col;
}
}
}