Quantcast
Channel: Processing Forum
Viewing all articles
Browse latest Browse all 1768

Re : video queue mixer

$
0
0
here is my present mockup (bad fast draft)
  1. /**
     * Frames
     * by Andres Colubri.
     *
     * Moves through the video one frame at the time by using the
     * arrow keys. It estimates the frame counts using the framerate
     * of the movie file, so it might not be exact in some cases.
     */

    import processing.video.*;

    Movie movi;

    int newFrame = 0;
    int movFrameRate = 30;
    boolean show=true;

    ArrayList<track> moviez;

    void setup() {
      size(640, 360);
      background(0);
      moviez= new ArrayList<track>();
      // Load and set the video to play. Setting the video
      // in play mode is needed so at least one frame is read
      // and we can get duration, size and other information from
      // the video stream.
      movi = new Movie(this, "transit.mov");

      // Pausing the video at the first frame.
      movi.play();
      movi.jump(0);
      movi.pause();
      moviez.add(new track(movi, 10, 200, 1));
      moviez.add(new track(movi, 10, 200, 1));
      moviez.add(new track(movi, 10, 200, 1));
      moviez.add(new track(movi, 10, 200, 1));
      moviez.add(new track(movi, 10, 200, 1));
          track t=moviez.get(0);
        t.start(true);
    }

    void movieEvent(Movie m) {
      m.read();
    }

    void draw() {
      background(0);
      for (int i=0;i<moviez.size()-1;i++) {
        track t=moviez.get(i);
        t.show();
      }
      show=true;
      if (moviez.size()>1) {
        track t=moviez.get(1);
        track te=moviez.get(0);
        t.start(te.next());
      }
      else if (moviez.size()>0) {
        track t=moviez.get(0);
        if (t.die()) {
          moviez.remove(0);
          println("die");
        }
      }


      //  background(0);
    }

    void keyPressed() {
      track t=moviez.get(0);
      t.start(true);
    }

    int getFrame(Movie mov) {   
      return ceil(mov.time() * 30) - 1;
    }


    class track {
      int a, b, spor;
      int opacity=0;
      Movie mov;
      track(Movie m, int aa, int bb, int ss) {
        mov=m;
        a=aa;
        b=bb;
        spor=ss;
        mov.play();
        mov.jump(a/30);
        mov.pause();
      }
      void start(boolean starter) {
        if (starter) {
          mov.play();
        }
      }
      boolean next() {
        boolean returner=false;
        if (getFrame(mov)<a+55) {
          opacity+=10;
        }
        else if (getFrame(mov)>b-55) {
          returner=true;
          opacity-=10;
        }
        return returner;
      }
      void show() {
        tint(255, opacity);
        image(mov, 0, 0, width, height);
        noTint();
      }
      boolean die() {
        if (getFrame(mov)>b) {
          return true;
        }
        return false;
      }
    }


_____
allways on the lookout for new toys to mod
_____

Viewing all articles
Browse latest Browse all 1768

Trending Articles