Skip to content

Instantly share code, notes, and snippets.

@whatrocks
Created April 7, 2015 11:25
Show Gist options
  • Save whatrocks/071c729fcbdc02a48057 to your computer and use it in GitHub Desktop.
Save whatrocks/071c729fcbdc02a48057 to your computer and use it in GitHub Desktop.
Terminal Man - sketch for music video
// ----------------------
// T E R M I N A L M A N
// ----------------------
// @ w h a t r o c k s
// ----------------------
// import video library
import processing.video.*;
// movies
Movie pipeMovie;
Movie doomMovie;
Movie solitaireMovie;
Movie toastersMovie;
Movie mazeMovie;
Movie wc2Movie;
Movie tiefighterMovie;
Movie rollercoasterMovie;
// images
PImage skull;
PImage miniSkull;
// font
PFont f;
void setup() {
size(800, 800);
smooth();
// load the pictures
skull = loadImage("skull2.png");
miniSkull = loadImage("skull2.png");
// resize the big skull to dimensions of the canvas
skull.resize(width, height);
// black background
background(0);
// load the font
f = loadFont("TwCenMT-BoldItalic-100.vlw");
// load the movies
mazeMovie = new Movie(this, "maze.mov");
mazeMovie.loop();
solitaireMovie = new Movie(this, "solitaire.mov");
solitaireMovie.loop();
doomMovie = new Movie(this, "doom.mov");
doomMovie.loop();
pipeMovie = new Movie(this, "pipe.mov");
pipeMovie.loop();
toastersMovie = new Movie(this, "toasters.mov");
toastersMovie.loop();
tiefighterMovie = new Movie(this, "tiefighter.mov");
tiefighterMovie.loop();
wc2Movie = new Movie(this, "wc2.mov");
wc2Movie.loop();
rollercoasterMovie = new Movie(this, "rollercoaster.mov");
rollercoasterMovie.loop();
}
void draw() {
// black background
if (key == 'x') {
background(0);
}
// play doom video
if (key == '1') {
image(doomMovie, 0, 0, width, height);
}
// play maze video
if (key == '2') {
image(mazeMovie, 0, 0, width, height);
}
// play toasters video
if (key == '3') {
image(toastersMovie, 0, 0, width, height);
}
// play pipes video
if (key == '4') {
image(pipeMovie, 0, 0, width, height);
}
// play solitaire video
if (key == '5') {
image(solitaireMovie, 0, 0, width, height);
}
// play tiefighter video
if (key == '6') {
image(tiefighterMovie, 0, 0, width, height);
}
// play rollercoaster video
if (key == '7') {
image(rollercoasterMovie, 0, 0, width, height);
}
// play wc2 video
if (key == '8') {
image(wc2Movie, 0, 0, width, height);
}
// print mini skulls everywhere!
if (key == 's') {
miniSkull.resize(width/10, height/10);
image(miniSkull, random(-width, width), random(-height, height));
}
// flashy background colors!
if (key == 'b') {
background(int(random(255)), int(random(255)), int(random(255)), int(random(255)));
}
// draw blue lines from the center
if (key == 'l') {
stroke(0, random(200, 255), random(200, 255), 150);
line(width/2, height/2, width/2 + random(-width, width), height/2 + random(-height, height));
}
// Load big skull picture on top of all these other backgrounds
image(skull, 0, 0);
// show 'terminal man' text, even on top of the big skull
if (key == 't') {
textFont(f);
textAlign(CENTER);
fill(random(155, 255), 0, random(150, 255));
text("TERMINAL MAN", width/2, height/2);
fill(0, random(0, 255), random(150, 255));
text("TERMINAL MAN", width/2+10, height/2+10);
}
}
// Called everytime a new frame is available
void movieEvent(Movie m) {
m.read();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment