createCanvas(windowWidth, windowWidth*.75);
cam = createCapture(VIDEO);
let backgroundX = frameCount % height;
let randomPix = (backgroundX + cam.height * (cam.height)) * 4;
background(cam.pixels[randomPix], cam.pixels[randomPix + 1], cam.pixels[randomPix + 2]);
for (let y = 0; y < cam.height; y += step) {
for (let x = 0; x < cam.width; x += step) {
let index = (y * cam.width + x) * 4;
let r = cam.pixels[index];
let g = cam.pixels[index + 1];
let b = cam.pixels[index + 2];
let a = cam.pixels[index + 3];
let mappedX = Math.floor(map(x, cam.width, 0, 0, width));
let mappedY = map(y, 0, cam.height, 0, height);
for (let i = 0; i < 255; i+=newC) {
translate(mappedX, mappedY);
let stitch = new Stitch(0, 0);
ellipse(width/2,height/2,height*1.25);
ellipse(width/2,height/2,height*.75);
line(width*17/40,height/12,width*18/40,height/12);
line(width*17/40,height/12,width*22/40,height/12);
line(width*19/40,height/15,width*19/40,height*7/50);
line(width*21/40,height/15,width*21/40,height*7/50);
constructor(x, y, r = step) {
line(this.x+sW/2, this.y+sW/2, this.x+this.r-sW/2,this.y+this.r-sW/2);
line(this.x+this.r-sW/2, this.y+sW/2, this.x+sW/2,this.y+this.r-sW/2);
function windowResized() {
resizeCanvas(windowWidth, windowWidth*.75);