Advertisement
xeromino

paintingVideo

Mar 30th, 2017
275
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import processing.video.*;
  2. import com.hamoid.*;
  3.  
  4. VideoExport videoExport;
  5. Movie movie;
  6.  
  7. void setup() {  
  8.   size(1280, 720);
  9.   background(0);
  10.   movie = new Movie(this, "beyonce.mp4");
  11.   movie.play();
  12.  
  13.   videoExport = new VideoExport(this, "internetVideo.mp4");
  14.   videoExport.startMovie();
  15. }
  16.  
  17. void movieEvent(Movie movie) {  
  18.   movie.read();
  19. }
  20.  
  21. void draw() {
  22.   if (frameCount>5) {
  23.     paint();
  24.     videoExport.saveFrame();
  25.   }
  26. }
  27.  
  28. void paint() {
  29.   if (mousePressed) {
  30.     int sz = (int) random(25, 100);
  31.     PImage tmp = movie.get(mouseX, mouseY, sz, sz);
  32.     tint(255, 100);
  33.     image(tmp, mouseX, mouseY);
  34.   }
  35.   // resized actual video with white dot representing the mouse position
  36.   copy(movie, 0, 0, width, height, 0, 0, width/5, height/5);
  37.   fill(255);
  38.   stroke(0);
  39.   float px = map(mouseX, 0, width, 0, width/6);
  40.   float py = map(mouseY, 0, height, 0, height/6);
  41.   ellipse(px, py, 5, 5);
  42. }
  43.  
  44. void keyPressed() {
  45.   if (key == 'q') {
  46.     videoExport.endMovie();
  47.     exit();
  48.   }
  49. }
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement