import ddf.minim.*; AudioPlayer song; PImage b; PImage b2; PImage b3; PImage b4; String [] poems = { "We die with the dying: See, they depart, and we go with them.", "We are born with the dead: See, they return, and bring us with them.", "Wait without thought, for you are not ready for thought: So the darkness shall be the light, and the stillness the dancing.", "T.S. Eliot, Four Quartets", }; PFont f; float x; int index = 0; int timer = 0; void setup () { size(800,450); Minim.start(this); // load mysong.mp3 from the data folder song = Minim.loadFile("My Handful of Circumstance.mp3"); song.play(); f= loadFont ("AgencyFB-Reg-36.vlw"); x = width; b = loadImage ("seedlings_resize.jpg"); b2 = loadImage ("shadow_effects_resize1.jpg"); b3 = loadImage ("rose_candles_resize.jpg"); } void draw() { float sec = millis()/1000.0; if (sec > 6.0){ timer++; } image (b,0,0,800,480); fill(0, 150); //text with opacity of 150 textFont (f,36); textAlign (LEFT); text (poems[index],x,60); x = x-1; float w = textWidth (poems[index]); if (x <= -w){ x = width; index = (index + 1 ) % poems.length; } //** Enter image 2 if (sec >= 25){ timer++; image (b2,0,0,400,600); fill(0, 150); textFont (f,36); textAlign (LEFT); text (poems[index],x,60); x = x-1; float w2 = textWidth (poems[index]); if (x <= -w){ x = width; index = (index + 1 ) % poems.length; } } //**** Enter image 3 if (sec >=60.0){ timer++; image (b3,0,0,300,600); fill(0, 200); textFont (f,36); textAlign (LEFT); text (poems[index],x,60); x = x-1; float w3 = textWidth (poems[index]); if (x <= -w){ x = width; index = (index + 1 ) % poems.length; } } //** ahhh...still can't get the text to stop! /*void stop() { song.close(); super.stop(); }*/ }