//Bradley v0.1 //interview with Michael Ratner //by Marguerite Mooradian //thank you David House, Michael Ratner, BRADLEY MANNING import ddf.minim.*; import ddf.minim.signals.*; import ddf.minim.analysis.*; import ddf.minim.effects.*; import gifAnimation.*; Minim minim; Spoke spoke1; Spoke spoke2; Spoke spoke3; Spoke spoke4; AudioPlayer intro; //buttons Gif nonLoopingGif1; Gif nonLoopingGif2; Gif nonLoopingGif3; Gif nonLoopingGif4; Gif nonLoopingGif5; void setup() { size(1200,750); smooth(); minim = new Minim(this); loadImage("bkgd.jpg"); spoke1 = new Spoke(595,650,50, "a.mp3"); spoke2 = new Spoke(745,650,50, "b.mp3"); spoke3 = new Spoke(895,650,50, "c.mp3"); spoke4 = new Spoke(1045,650,50, "d.mp3"); println("gifAnimation " + Gif.version()); // create the GifAnimation object for playback nonLoopingGif1 = new Gif(this, "cra.gif"); nonLoopingGif1.play(); nonLoopingGif1.ignoreRepeat(); nonLoopingGif2 = new Gif(this, "crb.gif"); nonLoopingGif2.play(); nonLoopingGif2.ignoreRepeat(); nonLoopingGif3 = new Gif(this, "crc.gif"); nonLoopingGif3.play(); nonLoopingGif3.ignoreRepeat(); nonLoopingGif4 = new Gif(this, "crd.gif"); nonLoopingGif4.play(); nonLoopingGif4.ignoreRepeat(); //loading screen image nonLoopingGif5 = new Gif(this, "opener.gif"); nonLoopingGif5.play(); //loading screen sound intro = minim.loadFile("intro.mp3", 2048); } void draw() { smooth(); PImage b; b = loadImage("bkgd.jpg"); b.resize(1200,750); background(b); int s = second(); //65 second loading screen if (millis() < 65000){ fill(0); rect(0,0,1200,750); fill(0,255,0); intro.play(); image(nonLoopingGif5,0,0); text(":Bradley v0.1 by Marguerite Mooradian",10,40); text("many thanks to David House and Michael Ratner",10,60); text("and BRADLEY MANNING",10,80); text("loading...",10,100); rect(s+70,85,10,20); text("so this is the bug-filled beta...",10,620); text("coming soon:",10,640); text("bio, subtitles",30,660); text("ability to pause sounds",30,680); text("proper transparency on Bradley image (and world)",30,700); text("more interactivity, animation, pop-out cardboard mustaches",30,720); } else { //buttons //01 image(nonLoopingGif1,400,50); //02 image(nonLoopingGif2,450,50); //03 image(nonLoopingGif3,450,50); //04 image(nonLoopingGif4,750,100); //SOUND BUTTONS spoke1.display(mouseX,mouseY); spoke2.display(mouseX,mouseY); spoke3.display(mouseX,mouseY); spoke4.display(mouseX,mouseY); } } void mousePressed() { if (spoke1.contains(mouseX,mouseY)) { spoke1.ring(); nonLoopingGif1.play(); } if (spoke2.contains(mouseX,mouseY)) { spoke2.ring(); nonLoopingGif2.play(); } if (spoke3.contains(mouseX,mouseY)) { spoke3.ring(); nonLoopingGif3.play(); } if (spoke4.contains(mouseX,mouseY)) { spoke4.ring(); nonLoopingGif4.play(); } } public void stop() { intro.close(); spoke1.close(); spoke2.close(); spoke3.close(); spoke4.close(); super.stop(); } class Spoke { float x; float y; float r; AudioSnippet dingdong; Spoke (float x_, float y_, float r_, String filename) { x = x_; y = y_; r = r_; dingdong = minim.loadSnippet(filename); } void ring() { if (!dingdong.isPlaying()) { // The ring() function plays the sound, as long as it is not already playing. // rewind() ensures the sound starts from the beginning. dingdong.rewind(); dingdong.play(); } } // Is a point inside the spoke (used for mouse rollover, etc.) boolean contains(float mx, float my) { if (dist(mx,my,x,y) < r) { return true; } else { return false; } } // Show the spoke void display(float mx, float my) { if (contains(mx,my)) { fill(255,255,0,123); } else { fill(255,0,0,123); } noStroke(); rectMode(CENTER); rect(x,y,r,r); } void close() { // The spoke has a close() function to close the AudioPlayer object. dingdong.close(); } }