xxxxxxxxxx
var img;
var x = 0;
var y = 0;
function setup() {
c = createCanvas(640, 480);//breite, höhe
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() {
//background(255); //background colour, yeets camera
//image(img, mouseX, 0); //image position, mit der maus verschiebbar, feststehend, etc.
// 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); //linie rausholen, verändert sich in der bewegung
var line = img.get(0, y, img.width, 1);
// displayed at the current position x
translate(x, 0);
translate(0, y);//bewegt ausgangspunkt der rotation
rotate(cos(millis()/500.0)); //rotation, je kleiner desto aggressiver
//tint(y/2550, 0, 250); //colour change
image(line, 0, 0);//line length, line start pos
// 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');
}
// rotate(sin(millis()/1000.0));
// translate(random(width), 0);
// translate(width/2+sin(millis()/1000.0)*width/2, 0);