Advertisement
xeromino

video

Jan 27th, 2016
171
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. import processing.video.*;
  3. Movie movie;
  4. PGraphics pg;
  5. float scal = 3, r;
  6. int w, h, x, y, c;
  7. PImage tmp;
  8. boolean changeBM=true;
  9.  
  10. void setup() {
  11.   size(1280, 720, P2D);
  12.   background(255);
  13.   tmp = createImage(720, 360, RGB);
  14.   movie = new Movie(this, "sample.mp4");
  15.   movie.loop();
  16.   movie.speed(.5);
  17.   imageMode(CENTER);
  18. }
  19.  
  20. void draw() {
  21.   //tint(255, 150);
  22.   if (frameCount%300==0) {
  23.     changeBM =! changeBM;
  24.   }
  25.   if (changeBM) {
  26.     blendMode(DARKEST);
  27.   } else {
  28.     blendMode(LIGHTEST);
  29.   }
  30.   if (frameCount%10==0) drawStuff();
  31.   // filter(GRAY);
  32. }
  33.  
  34. // Called every time a new frame is available to read
  35. void movieEvent(Movie m) {
  36.   m.read();
  37. }
  38.  
  39. void drawStuff() {
  40.   tint(255, 50);
  41.   tmp = movie;
  42.   //scale(2);
  43.   pushMatrix();
  44.   translate(width/2, height/2);
  45.   //rotate(r);
  46.   image(tmp, 0, 0);
  47.   popMatrix();
  48.   //r += radians(3);
  49. }
  50.  
  51. void keyPressed() {
  52.   saveFrame("image-###.jpg");
  53. }
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement