Monthly Archives: April 2014

Project #3C

Coding used for final project

 

import processing.video.*;
//name the video so it can find it further on down.
Movie thevideo;
boolean isPlaying;
boolean isLooping;

// An array of font,
String[] headlines = {
“Sometimes we are looking for the beauty in broken things – 2014”,

};
//prepare the font lables.
PFont f; // Global font variable
float x; // horizontal location of headline
int index = 0;
void setup() {
//setting up frame size and frame rate, along with speed of imagery
size(640, 480);
frameRate(10);
f = createFont(“Arial”,50,true);
// Initialize headline offscreen to the right
x = width;

//import video from data file
thevideo = new Movie(this, “Sequence 1.mov”);

thevideo.loop(); //plays the movie over and over
isPlaying = true;

}
//DISPLAY IMAGE WITH NO MOVEMENT RELATED TO MOUSE X AND Y
void draw() {
background(0);
image(thevideo, 0, 0);

//MOVE THE FONT DOWN AT THE BOTTOM OF THE IMAGE
// Display headline at x location
textFont(f,50);
textAlign(BOTTOM);
text(headlines[index],x,470);
//allows the speed to be effected
// Decrement x
x = x – 3;

//THIS CODE WOULD BE USED TO MAKE IT REPEAT OVER AND OVER.
// If x is less than the negative width,
// then it is off the screen
//float w = textWidth(headlines[index]);
// if (x < -w) {
// x = width;
// index = (index + 1) % headlines.length;
}

 

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

//causes the image to pause.
void keyPressed() {
if (key == ‘p’) {
// toggle pausing
if (isPlaying) {
thevideo.pause();
} else {
thevideo.play();
}
isPlaying = !isPlaying;

//create a loop to the begining.
} else if (key == ‘l’) {
// toggle looping
if (isLooping) {
thevideo.noLoop();
} else {
thevideo.loop();
}
isLooping = !isLooping;

//makes the footage stop
} else if (key == ‘s’) {
// stop playing
thevideo.stop();
isPlaying = false;

//cut to new scene
} else if (key == ‘c’) {
// jump to a random time
thevideo.jump(random(thevideo.duration()));
}
}

Advertisements