xxxxxxxxxx
68
var video;
var button;
var snapshots = [];
var counter = 0;
var go = false;
function setup() {
createCanvas(640, 720);
video = createCapture(VIDEO, ready);
video.size(320, 240);
video.hide();
button = createButton('snap');
button.mousePressed(takesnap);
}
function ready() {
go = true
}
function takesnap() {
//snapshots.push(video.get());
// image(video,320,240);
}
function draw() {
tint(255, 0, 0);
image(video, 0, 0, mouseX, mouseY);
tint(0, 255, 0, 10);
image(video, 320, 0);
tint(0, 0, 255, 10);
image(video, 0, 240);
tint(255, 50);
image(video,320,240);
// if (go) {
// snapshots[counter] = push(video.get());
// counter++;
// if (counter == 16) {
// counter = 0
// }
// }
var w = 80;
var h = 60;
var x = 0;
var y = 480;
for (var i = 0; i < snapshots.length; i++) {
image(snapshots[i], x, y, w, h);
x = x + w
if (x > width) {
y = y + h
x = 0
}
}
}