Project_2_codes

code String THREED = P3D; String JAVA = P2D; String MODE = JAVA;

boolean renderer = true;

import ddf.minim.*; Minim minim; AudioPlayer Aplayer;

void setup { if (renderer == true) MODE = THREED; if (renderer == false) MODE = JAVA; size(1000,560,MODE); frameRate(64); font = loadFont("KozGoPro-Light-18.vlw"); background(0); noCursor; BGround = loadImage("rainer.png"); // myMovie = new Movie(this, "Moi.mov");

minim = new Minim(this); Aplayer = minim.loadFile("260.mp3"); }

void draw {

//   if(myMovie.available) { //   myMovie.read; // } //  image(myMovie, 0, 0);

if (rainer) { rain; player = false; } if (spherer) { spheric; }

if (starter) { start; } if (spiriter) { spirit; } if (player) { Playing; } }

void mouseReleased { if (rainer){img_count++;} if (spiriter) { T_Count+=1; Alpha_Flux = true;

} }

void keyReleased { f=1; }

void keyPressed { println( upward+ " " + f+ "  "+ keyCode); if(keyPressed && keyCode == 38) { upward+=g; f+=0.05; }

if(keyCode == 40) { upward-=g; f+=0.05; } if(keyCode == 49) { rainer = true;

spiriter = false; spherer = false; } if(keyCode == 50) { rainer = false; player = false; spiriter = false; spherer = true; } if(keyCode == 51) { rainer = false; spherer = false; spiriter = true; player = false; } if(keyCode == 52) { rainer = false; spherer = false; spiriter = false; player = true; } }

import processing.video.*; float movepos = 0;

Movie vie; float load_M = 0; float Var_1 = 0; float Var_2 = 1; float Var_3 = 0;

/*Function begins*/

void Playing {

background(0); imageMode(CENTER); fill(0);

if(load_M == 0) { load;  load_M+=1; }    //loads the movie once

if(load_M == 1) { image(vie, width/2, height/2); vie.play; }

// pushMatrix;  fill(0,150);  noStroke;  translate(mouseX, mouseY);  box(30);  popMatrix;

if(vie.time == vie.duration) { rainer = true; }

movepos = vie.time; rectMode(CENTER); noFill; stroke(255); rect(width/2,height/2, Var_1, Var_1);

rect(width/2,height/2, Var_1-1000, Var_1-1000);

Var_1 = pow (Var_2, Var_3);

Var_2+=0.1; Var_3 = vie.time/10;

println( vie.time +" " + vie.duration );}

/*Function ENDs*/

void load { vie = new Movie(this, "test.mov");}

void dots{ strokeWeight(1); for (int i = 0; i< cols; i = i+5) { for(int j = 0; j< rows; j = j+5) { myArray[i][j] = int(random(255)); }}

for (int i = 0; i< cols; i= i+5) { for(int j = 0; j< rows; j= j+5) { stroke(myArray[i][j], myArray[i][j], myArray[i][j] ); point(i,j); }}

}

float Break = 0; float img_count = 0 ;

/*Function begins*/

void rain { renderer = true; imageMode(CORNER); background(0,10); tint(r*2,r,r*1.3, Alpha1); image(BGround,0,0);

dots;

strokeWeight(1); noFill; stroke(255);

translate(mouseX, mouseY, r); rotateZ(r/20); box(25);

if (mousePressed){ Alpha1+=10; r+=5; }

if (!mousePressed){ Alpha1-=5; r-=10; }

if (r < 01 && Break < 4) { r= 0; }

if (Alpha1 < 0) { Alpha1= 0; }

if (!mousePressed && r == 10){ Break++; }

if (r < -1000){spherer=true;}

println(r+ " " + img_count);

if(keyPressed&&key==' '){ Aplayer.play; } }

// //void stop { // Aplayer.close; // minim.stop; // super.stop; //}

float fadeoha = 500;

/*Function begins*/

void spheric { rainer = false; renderer = true;             //

background(0); r++;                         //rotate variable g = pow (e, f);              //acceleration equation

pushMatrix; fill(0,150); noStroke; translate(mouseX, mouseY); box(30); popMatrix;

fill(96,127,117);            // font and text display textFont(font); textAlign(RIGHT); text(ss, 980, 540); stroke(96,127,117);

pushMatrix;                //earth home creation translate(width/2, height/2, 25*upward); rotateZ(PI/3); rotateY(r/100); fill(0,0); sphere(width); popMatrix;

// pushMatrix; //   translate(width/2, height/2, 7500+upward); //   rotateZ(PI/3); //   rotateX(r/100); //   rotateY(r/100); //   fill(255,70,70, 150); //   stroke(0); //   sphere(width); // popMatrix;

if(keyPressed && keyCode == 38) { upward-=g; f+=0.05; } //up arrow operation if(keyPressed && keyCode == 40) { upward+=g; f+=0.05; } //down arrow operation

if(upward > 5) { upward=5; }                            //movement cap

if( f > 5) f=5;                                         //acceleration cap

if(upward < 5 && upward > -1000) ss = s1;               //text overlays till next note.

if(upward < -1000 && upward > -3000) ss = s2;

if(upward < -3000 && upward> -8000) ss = s3;

if(upward < -8000) { upward=-8600; g=0; }                //locks movement

if (upward < -8000 && mousePressed) fadeout=true;        //activates fadeout

if (fadeoha <= 500 && fadeoha > 0) { fill(0, fadeoha); rect(0,0, width, height); fadeoha-=2; }  // fades in the scene

dots;                                                  // array dots

if (fadeout) { fill(255, Alpha2); rect(0,0, width, height); Alpha2+=5; }                        //fades out scene

if (Alpha2 > 300) { spiriter = true; }                   //moves to next scene

}

//STAGE 5: Spirit scene box has afterlife consideration. boolean goner = false; float Alpha_G = 255; boolean Entertain = false; boolean negationH = false; // flips text box float H1 = 25; float H2 = 100; float H3 = 125; float H4 = 117.5; boolean negationV = false; // flips text box float V1 = 25; float V2 = 100; float V3 = 125; float V4 = 130; boolean Alpha_Flux = false; //makes text fade in and out float Fier = 0; //alpha shift variable

int T_Count = 0; // counter for the text strings String T0 = "uhh..."; String T1 = "hmm..."; String T2 = "..."; String T3 = "where am I"; String T4 = "WHAT am I ?!"; String T5 = "I feel..."; String T6 = "I feel so strange."; String T7 = "could it be..."; String T8 = "That I'm dead?"; String T15 = "damn."; String T16 = ". . ."; String T20 = "Boring!";

String TA = T0;

/*Function begins*/

void spirit { renderer = false; spherer = false; background(255); rectMode(CENTER); smooth;

stroke(0,Alpha_G); rect(mouseX,mouseY,50,50); fill(0,Fier);

noStroke; quad(mouseX+H1,mouseY,mouseX+H1,mouseY,mouseX+H2,mouseY+V2,mouseX+H3,mouseY+V2); rect(mouseX+H4, mouseY+V3, 250, 50);

fill(255); textFont(font); textAlign(CENTER); text(TA, mouseX+H4, mouseY+V4);

//Fading if(Fier == 500) Alpha_Flux = false; if(Alpha_Flux) Fier+=5; if(!Alpha_Flux) Fier-=5; if(Fier < 0) Fier = 0;

//text constrains if(mouseX > 900) negationH = true ; if(mouseX < 100) negationH = false ; if(mouseY > 460) negationV = true ; if(mouseY < 100) negationV = false ; if(negationH)  { H1 = -25; H2 = -100; H3 = -125; H4 = -117.5; } if(!negationH) { H1 = 25; H2 = 100; H3 = 125; H4 = 117.5; } if(negationV)  { V1 = -25; V2 = -100; V3 = -125; V4 = -120; } if(!negationV) { V1 = 25; V2 = 100; V3 = 125; V4 = 130; }

//Text switch println(TA); if(T_Count == 0) TA = T0; if(T_Count == 1) TA = T1; if(T_Count == 2) TA = T2; if(T_Count == 3) TA = T3; if(T_Count == 4) TA = T4; if(T_Count == 5) TA = T5; if(T_Count == 6) TA = T6; if(T_Count == 7) TA = T7; if(T_Count == 8) TA = T8; if(T_Count == 15) TA = T15; if(T_Count == 16) TA = T16; if(T_Count == 20) TA = T20;

//goner end segment if(T_Count >= 20 && Fier == 0) goner = true; if(goner)Alpha_G--;

if (Alpha_G < -100){} }

// LABELS INCORRECT!!!!!!

//float A = 1; boolean expo = false; boolean starter = true; boolean rainer = false; boolean spherer = false; boolean spiriter = false; boolean player = false; boolean A_shift = false; boolean fadeout = false;

PFont font;

//Stage 1

//Stage 2 //array vars int cols = 1000; int rows = 560; int[][] myArray = new int[cols][rows]; int Alpha1 = 0; //others vars PImage BGround;

//Stage 3 //floats float r = 0;                //sphere rotate counter float upward = 5;           //z-axis shift variable float e = 2;                //exponent of float g    float f = 1;              //variable of float g equation float g = e;                //accelerated shift value float Alpha2 = 0; //Text stings String s1 = "we went up and down"; String s2 = "until we couldn't tell anymore"; String s3 = "and then it appeared like a glorious light"; String ss = s1; String sn = ""; String ts = "Start";

//Stage 4

//Stage 5

//Stage 6

//float posX1 = 320; //float posY1 = 180; //float ellipseWidth1 = 15; //float ellipseHeight1 = 20; //float posX2 = 100; //float posY2 = 100; //float ellipseWidth2 = 40; //float ellipseHeight2 = 30; //float a = random(width); //float b = random(height); //float c = random(width); //float d = random(height); code