Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- PImage[] images = new PImage[10];
- int x = 0;
- int y = 0;
- import processing.video.*;
- Capture cam;
- void setup() {
- //size(4032, 3024);
- size(1920, 1080);
- images[0] = loadImage("IMG_1.JPG");
- images[1] = loadImage("IMG_2.JPG");
- images[2] = loadImage("IMG_3.JPG");
- images[3] = loadImage("IMG_4.JPG");
- images[4] = loadImage("IMG_5.JPG");
- images[5] = loadImage("IMG_6.JPG");
- images[6] = loadImage("IMG_7.JPG");
- images[7] = loadImage("IMG_8.JPG");
- images[8] = loadImage("IMG_9.JPG");
- images[9] = loadImage("IMG_10.JPG");
- frameRate(5);
- String[] cameras = Capture.list();
- if (cameras.length == 0) {
- println("There are no cameras available for capture.");
- exit();
- } else {
- println("Available cameras:");
- for (int i = 0; i < cameras.length; i++) {
- println(cameras[i]);
- }
- }
- cam = new Capture(this, cameras[3]);
- cam.start();
- }
- void draw() {
- if (cam.available() == true) {
- cam.read();
- }
- image(cam, 0, 0);
- x = int(random(0, width));
- y = int(random(0, height));
- int randomx = int(random(x-100, x+100));
- int randomy = int(random(y-100, y+100));
- int index = int(random(0, 10));
- PImage smallImg = images[index].get(randomx, randomy, 1000, 1000);
- image(smallImg, x, y);
- //x = x + 50;
- //if (x > width) {
- // x = 0;
- // y = y + 50;
- // if (y > height) {
- // y = 0;
- // }
- //}
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement