Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import processing.video.*;
- Capture cam;
- int[] noise;
- int ticks = 0;
- void setup() {
- size(640, 480);
- cam = new Capture(this, width, height, 30);
- cam.start();
- noise = new int[width * height];
- for (int i=0; i<width * height; i++) {
- noise[i] = (int)random(256);
- }
- }
- void draw() {
- if (cam.available() == true) {
- cam.read();
- cam.loadPixels();
- int index = 0;
- for (int y=0; y<height; y++) {
- for (int x=0; x<width; x++) {
- int v = (cam.pixels[index] >> 8) & 0xff;
- v ^= (noise[index] + ticks) & 0xff;
- color c = (v>128)?0xffffff:0;
- //color c = v * 0x10101;
- set(x, y, c);
- index++;
- }
- }
- }
- ticks = (ticks + 1) & 0xff;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement