Movie Library? How to add a movie into a program with three stages (my code provided)

edited December 2014 in Questions about Code

Hi, I merged my codes together (previous question, with the two images) successfully..however, the movie (first stage) is not working :( The code is saying, its missing a library for the video... I have my movie in the data folder.. I am not sure what I can do.. I separated the two codes together.

**The movie is only 5 seconds! If that helps!

**Thank you for your help! ** **How can I put this: **

import processing.video.*;

String PATH = "lietoomee.mov";
Movie mov;

void setup() {
size(200, 200);
mov = new Movie(this, PATH);
mov.play();
mov.speed(1);
mov.volume(1);
}

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

void draw() {
image(mov, 0, 0);
}

**Into this: **

PImage startscreen;
PFont title;
int screensizex, screensizey, stage;
int i = 0;
int j = 0;
int counti = 0;
int countj = 0;
int tmpX = 0;
int tmpY = 0;

int moveX = width/2;
int moveY = height/2;

int valueX = 0;
int valueY = 0;

int Anum = 0;
String Ename;
String Csymbol;
float Aweight = 0.0; 
float AwGraph = 0.0; 
PImage photo;

//Pictures of emotions
PImage anger;
PImage disgust;
PImage contempt;
PImage fear;
PImage what; 
PImage pintro;


void setup () {
  stage = 1;
  screensizex = 800;
  screensizey= 800;
  size (800, 800);
  startscreen = loadImage ("IntroMain.jpg");
  image(startscreen, 0, 0, 800, 800);
  title = createFont ("font", 1000, true);

  frameRate(10);
  colorMode(RGB, 100);
  fear = loadImage ("ffear.jpg");
  anger = loadImage ("Angerr.jpg");
  disgust = loadImage ("Disgustt.jpg");
  contempt = loadImage ("ccontempt.jpg");
  what = loadImage ("Whatare copy.jpg");
  pintro = loadImage ("IntroMain.jpg");
}

void draw () {
  if (stage==1) {
    image (pintro, 0, 0, 800, 800);

    if (keyPressed) {
      stage = 2;
    }
  }

  if (stage==2) {
    textAlign (CENTER);
    image (what, 0, 0, 800, 800);

    if (mouseX > 700 && mouseY >700 && mouseY <800 == true) {
      stage = 3;
    }
  }


  if (stage==3) {
    background(0, 0, 0, 20);//Color of the background
    noFill();//No Color
    strokeWeight(1);//Thickness of Stroke
    textSize(10); //Size of text

    int wdth = width;//width of the integer
    int hght = height;//height of the integer

    textSize(60); //Size of Emotions, Text
    // on the bottom right - back
    fill(100, 50, 50, 50);//The Color of the Rectangle
    rect(0, 0, 400, 400);//The size/positioning of Rectangle
    fill(100, 100, 100, 100);//Color of Rectangle
    text( "ANGER", 200, height/4);//Size and positioning of text
    // on the top right - back
    fill(100, 100, 50, 50);//The Color of the Rectangle
    rect(400, 0, 800, 400);//The size/positioning of Rectangle
    fill(100, 100, 100, 100);//Color of Rectangle
    text( "DISGUST", 600, height/4);//Size and positioning of text
    // on the bottom left - back
    fill(50, 100, 100, 50);//The Color of the Rectangle
    rect(0, 400, 400, 800);//The size/positioning of Rectangle
    fill(100, 100, 100, 100);//Color of Rectangle
    text( "CONTEMPT", 200, 610);//Size and positioning of text
    // on the top left - back
    fill(50, 50, 100, 50);//The Color of the Rectangle
    rect(400, 400, 800, 800);//The size/positioning of Rectangle
    fill(100, 100, 100, 100);//Color of Rectangle
    text( "FEAR", 590, 610);//Size and positioning of text
  }
  if (mousePressed) {
    background(0, 0, 0, 20);
    noFill();
    strokeWeight(1);
    textSize(10);//Text Size
    if ( mouseButton == LEFT ) {
      moveX = mouseX;//Follows the mouse on the X axis
      moveY = mouseY;//Follows the mouse on the Y axis
      textSize(50); 
      fill(0, 0, 0, 100);
      rect(25, 25, 750, 750);
      if (moveX > width/2 && moveY > height/2 ) {  
        fill(50, 50, 100, 90);

        image(fear, 1, 30, 800, 800); 

      }
      if (moveX > width/2 && moveY < height/2 ) {  
        fill(100, 100, 50, 90);
        image (disgust, 1, 30, 800, 800);
        fill(100, 100, 10, 50);
      }      
      if (moveX < width/2 && moveY > height/2 ) {  
        fill(50, 100, 100, 90);
        image(contempt, 1, 30, 800, 800);
      }
      if (moveX < width/2 && moveY < height/2 ) {  
        fill(100, 50, 50, 90);

        image (anger, 1, 15, 800, 800);
      }    
      noFill();
    }
    noLoop(); 
  }
}





    void mousePressed()//When mouse is clicked
    {

      background(0, 0, 0, 20);
      noFill();
      strokeWeight(1);
      textSize(10);//

      if ( mouseButton == LEFT ) {

        moveX = mouseX;
        moveY = mouseY;
        textSize(50); 

        fill(0, 0, 0, 100);
        rect(25, 25, 750, 750);

        if (moveX > width/2 && moveY > height/2 ) {  // on the bottom right

          fill(50, 50, 100, 90);

        }

        if (moveX > width/2 && moveY < height/2 ) {  

          fill(100, 100, 50, 90);





          image (disgust, 1, 30, 800, 800);

          fill(100, 100, 10, 50);
        }      

        if (moveX < width/2 && moveY > height/2 ) {  

          fill(50, 100, 100, 90);






          image(contempt, 1, 30, 800, 800);
        }

        if (moveX < width/2 && moveY < height/2 ) {  

          fill(100, 50, 50, 90);

          image (anger, 1, 15, 800, 800);
        }    

        noFill();
      }


       noLoop(); 
    }

    void mouseReleased()
    {
      loop();
    }
Tagged:

Answers

  • Show your sketch that combines the two

  • @MTRE --- As for me your video code works normally:: no "missing library" And the second one works also (though i dont understand the mousePressed() boolean which is never fired. As for merging the twos what are you asking for??? Do you want to put the video before, for only 5""??? That is easy with some boolean like "isPlaying() - But in stage 1 you have 1 picture. so what? -I dont understand...

Sign In or Register to comment.