Advertisement
xeromino

videoPaint

Mar 28th, 2017
334
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import processing.video.*;
  2. Movie movie;
  3.  
  4. void setup() {  
  5.   size(1280, 720);
  6.   background(0);
  7.   movie = new Movie(this, "beyonce.mp4");
  8.   movie.play();
  9. }
  10.  
  11. void movieEvent(Movie movie) {  
  12.   movie.read();
  13. }
  14.  
  15. void draw() {
  16.   if (frameCount>5) {
  17.     paint();
  18.   }
  19. }
  20.  
  21. void paint() {
  22.   if (mousePressed) {
  23.     int sz = (int) random(25, 100);
  24.     PImage tmp = movie.get(mouseX, mouseY, sz, sz);
  25.     tint(255, 100);
  26.     image(tmp, mouseX, mouseY);
  27.   }
  28.   // resized actual video with white dot representing the mouse position
  29.   copy(movie, 0, 0, width, height, 0, 0, width/5, height/5);
  30.   fill(255);
  31.   stroke(0);
  32.   float px = map(mouseX, 0, width, 0, width/6);
  33.   float py = map(mouseY, 0, height, 0, height/6);
  34.   ellipse(px, py, 5, 5);
  35. }
  36.  
  37. void keyPressed() {
  38.   saveFrame("image-###.png");
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement