xxxxxxxxxx
var img;
var x = 0;
var y = 0;
function setup() {
c = createCanvas(640, 480);
background(0);
// activate webcam
img = createCapture(VIDEO); // selfie camera
//img = createCapture({ audio: false, video: { facingMode: { exact: "environment" } }}); // backside camera
img.size(640, 480);
img.hide();
}
function draw() {
// Pixel in Speicher laden
img.loadPixels();
//img.updatePixels();
// a one pixel wide column of the current webcam image
// at the current position x
//var line = img.get(x, 0, 1, img.height);
var line = img.get(0, y, img.width, 1);
// displayed at the current position x
translate(0, y);
//experimenting with axes rotation
translate(windowWidth/5, windowHeight/5);
rotate(sin (millis()/10000)*10.14);
image(line, 0, 0);
// increment the position x or set to zero (at the end)
if (x < img.width)
x += 1;
else
x = 0;
if (y < img.height)
y += 1;
else
y = 0;
}
function mousePressed()
{
saveCanvas(c, 'screenshot', 'jpg');
}