xxxxxxxxxx
98
// Mirror Image - Reverse
//let cam;
// function setup() {
// createCanvas(400, 400);
// cam = createCapture(VIDEO);
// cam.hide();
// }
// function draw() {
// background(220);
// image(cam,0,0);
// push();
// What is scale doing ? multiplying
// scale(-1,1);
// copy(cam,0,0,width/2,height,-width,0,width/2,height);
// }
// let cam;
// let a = 0;
// let aspeed;
// function setup() {
// createCanvas(400, 400);
// cam = createCapture(VIDEO);
// cam.hide();
// }
// function draw() {
// background(220);
// image(cam,0,0);
// push();
// scale(-1,1);
// copy(cam,0,0,width/2,height,-width,0,width/2,height);
// pop();
// tint(255,a);
// image(cam,0,0);
// a=+aspeed;
// if (a < 0|| a> 255){
// aspeed *= -1;
// }
// }
//Sit Scan Image - not video- capture
// let cam;
// let x = 0;
// function setup(){
// createCanvas(640,480);
// cam = createCapture(VIDEO);
// cam.hide();
// }
// function draw(){
// //background (220);
// // image(cam,0,0);
// cam.loadPixels();
// for (let y = 0; y<height; y++){
// let p = y * width + width /2;
// let i = 4 * p;
// let r = cam.pixels[i];
// let g =cam.pixels[i+1];
// let b = cam.pixels[i+2];
// let a = cam.pixels[i+3];
// let c = [r,g,b,a];
// stroke(c);
// point(x,y);
// }
// x++;
// if (x >= width) {
// x = 0;
// }
// }
//Color Gradation//
let numSwatches = 300;
let w;
let swSize = 360 / numSwatches;
let off = 0;
function setup() {
createCanvas(800, 400);
colorMode(HSB, 360, 100, 100);
w = width / numSwatches;
noStroke();
}
function draw() {
background(220);
for (let sw = 0; sw < numSwatches; sw++) {
let x = sw * w;
let h = sw * swSize + off;
h %= 360;
fill(h, 100, 100);
rect(x, 0, w, height);
}
off++;
}