hi, processers! I have been going through the funprogramming.com tutorial no. 126 and wanted to do the same thing, but using a webcam as a source to read. So I came up with this simple analog:
import processing.video.*;
Capture cam;
void setup() {
size(640, 480);
colorMode(HSB, 1);
noStroke();
smooth();
cam = new Capture(this, 640, 480, 30);
cam.start();
}
void draw() {
if (cam.available()) {
cam.read();
}
int x = width/2;
int y = height/2;
for (int i=0; i<100; i++) {
int c = cam.get(320, 240); // or cam.get(x*2, y*2), same result as cam.get(cam.width/2, cam.height/2)
float h = hue(c);
float s = saturation(c);
float b = brightness(c);
fill(h, s, b);
ellipse(x, y, s*20, s*20);
x += sin(h*7) * b * random(40);
y += cos(h*7) * b * random(40);
}
}
however it seems processing is drawing ellipses from the middle of the screen towards the sides, not randomly in any position on the screen. Do you have any ideas why is that happening?
Cheers!