fullscreen
void backDisplay() {
noStroke();
fill(0, 0, 0, 60);
rect(xr+speed2*5, 100, xr+200, 250);
fill(0, 0, 0, 170);
rect(xr2+speed2*10, 250, xr2+200, 250);
fill(0, 0, 0, 100);
rect(xr3+speed2*20, 400, xr3+200, 250);
}
void backDisplay2() {
fill(random(230), random(200), random(200), random(30));
ellipse(random(1100), random(750), xr/15+speed, xr/15+speed);
fill(random(220), random(200), random(200), random(50));
ellipse(random(1100), random(750), xr/5+speed, xr/5+speed);
}
void backDisplay3() {
noStroke();
fill(0, 0, 0, 10);
rect(0, speed2*(100-xr*2), width, 100);
fill(0, 0, 0, 20);
rect(0, speed2*(255-xr*2), width, 300);
fill(0, 0, 0,40);
rect(0, speed2*(555-xr*2), width, 550);
}
void move() {
xr = xr+speed2;
xr2 = xr2+speed2;
xr3 = xr3+speed2;
if (xr>height) {
xr=0;
xr2=0;
xr3=0;
fill(0,0,0,random(150));
}
if (xr<0) {
xr=height;
xr2=height;
xr3=height;
}
xr = xr+speed2*15;
xr2 = xr2+speed2*20;
xr3 = xr3+speed2*30;
speed=speed+t/2;
speed2=speed2+t/2;
}
class BeatListener implements AudioListener
{
private BeatDetect beat;
private AudioPlayer source;
BeatListener(BeatDetect beat, AudioPlayer source)
{
this.source = source;
this.source.addListener(this);
this.beat = beat;
}
void samples(float[] samps)
{
beat.detect(source.mix);
}
void samples(float[] sampsL, float[] sampsR)
{
beat.detect(source.mix);
}
}
void handleButtonEvents(GButton button) {
if (button == btnMusic && button.eventType == GButton.CLICKED) {
loadPath = selectInput();
songLoad = true;
}
if ((button == btnPlay || button == btnPlay2) && button.eventType == GButton.CLICKED) {
if(button == btnPlay2 && button.eventType == GButton.CLICKED){
imageIndex = 0;
}
if (songLoad && imgShowOn && fileList.length!=0) {
play = true;
minim = new Minim(this);
song = minim.loadFile(loadPath, 2048);
// if (song == null) print("Song has wrong extension");
// else {
song.play();
beat = new BeatDetect(song.bufferSize(), song.sampleRate());
beat.setSensitivity(1000);
beatListen = new BeatListener(beat, song);
// }
}
else if (!songLoad) {
println("select music to be played");
}
}
if (button == btnPics && button.eventType == GButton.CLICKED) {
path = selectFolder();
if (path==null) {
print("No Folder Selected");
}
else {
imgShowOn = true;
print(path);
}
}
if (button == btnColor && button.eventType == GButton.CLICKED) {
blkWhtOn = false;
}
if (button == btnBW && button.eventType == GButton.CLICKED) {
blkWhtOn = true;
}
if (button == btnBubbles && button.eventType == GButton.CLICKED) {
bubblesOn = true;
}
if (button == btnStripes && button.eventType == GButton.CLICKED) {
stripesOn = true;
}
if (button == btnShade && button.eventType == GButton.CLICKED) {
shadeOn = true;
}
if (button == btnVisual && button.eventType == GButton.CLICKED) {
visualOn = true;
}
if (button == btnStop && button.eventType == GButton.CLICKED) {
restart = true;
restart();
}
// if (button == btnRand && button.eventType == GButton.CLICKED) {
// cFadeOn = true;
// randOn = true;
// }
// if (button == btnGray&& button.eventType == GButton.CLICKED) {
// grayOn = true;
// }
}
//pictures move forward from opposite directions and cross over eachother while getting larger
void crossFade() {
images = loadImage(path + "/" + fileList[imageIndex]);
tint(255, random(20, 25));
image(images, p+move, 75, width/4+(sFade*2), height/2+(sFade*2));
sFade++;
if (imageIndex % 2 == 0) {
move--;
}
else {
move++;
}
tint(255, random(180, 210));
image(images, p-move, 75, width/6+sFade, height/3+sFade);
sFade++;
if (imageIndex % 2 == 0) {
move--;
}
else {
move++;
}
}
// Pictures split and go in different directions with each beat change
void doorsDisplay() {
images = loadImage(path + "/" + fileList[imageIndex]);
tint(255, random(200, 225));
image(images, p+(move*10), 75, width/3, height/1.5);
if (imageIndex % 2 == 0) {
move-=.5;
}
else {
move+=.5;
}
tint(255, random(200, 240));
image(images, p-(move*10), 75, width/3, height/1.5);
if (imageIndex % 2 == 0) {
move-=.5;
}
else {
move+=.5;
}
if (imageIndex+1!=fileList.length) {
images = loadImage(path + "/" + fileList[imageIndex+1]);
}
else {
images = loadImage(path + "/" + fileList[0]);
}
tint(185, 80);
image(images, p, 75, width/3, height/1.5);
if (blkWhtOn)filter(GRAY);
}
// Picture splits and goes in opposite directions with random opacity, creating "gray" effect
void grayDisplay() {
images = loadImage(path + "/" + fileList[imageIndex]);
tint(100, 120);
image(images, (p+150)-move, 75, width/3, height/1.5);
tint(130, 150);
image(images, (p+150)+move2, 75, width/3, height/1.5);
tint(225, 190);
image(images, (p+150)-move2, 75, width/3, height/1.5);
move+=6;
move2-=2;
// filter(GRAY);
}
//picture fades from one into another
void simpleFade() {//sFade
images = loadImage(path + "/" + fileList[imageIndex]);
tint(100, 80);
image(images, p+(sFade*50), 75, 605+(sFade*50), height/1.5+(sFade*50));
tint(205, 195);
image(images, p, 75, width/(3+sFade), height/(1.5+sFade/2));
sFade=sFade+.01;
}
void basicDisplay(){
images = loadImage(path + "/" + fileList[imageIndex]);
tint(100, 80);
image(images, p, 75, 450, 25);
}
void randDisplay() {
if (imageIndex%7==1) {
doorsOn = true;
doorsDisplay();
r++;
doorsOn = false;
}
else if (imageIndex%7==2) {
// blkWhtOn = true;
simpleFade();
r++;
// blkWhtOn = false;
}
else if (imageIndex%7==4) {
grayOn = true;
grayDisplay();
r++;
grayOn = false;
}
else if (imageIndex%7==6) {
cFadeOn = true;
crossFade();
r++;
cFadeOn = false;
}
}
import ddf.minim.*;
import ddf.minim.analysis.*;
import guicomponents.*;
GButton btnMusic, btnPics, btnPlay, btnPlay2, btnBW, btnBubbles;
GButton btnStripes, btnGray, btnRand, btnStop, btnColor, btnShade, btnVisual;
GWSlider senseSlider;
GLabel sensLbl;
Minim minim;
AudioPlayer song;
BeatDetect beat, beat2;
BeatListener beatListen;
float xr, xr2, xr3 = 120;
float speed2 = .1;
float t = .05;
int p = 400;
int filler;
float move, move2, r= 1;
float speed=100.0; // smaller = faster animation, larger= slower animation
float beatChange, sensitivity;
float sFade = .1;
int w, h, frameShowing, maxImages;
int s=2;
int imageIndex = 0;
int totalTime=0;
boolean imgShowOn, restart, songLoad, play, blkWhtOn, cFadeOn = false;
boolean bubblesOn, stripesOn, doorsOn, grayOn, randOn, stop, visualOn, shadeOn = false;
PImage images, eyeSlide, playBox, labelBox, labelBox2, toolBar, toolBar2;
String loadPath;
String path = "";
String[] fileList = loadFilenames(path);
void setup()
{
// size(screen.width-10, screen.height-10);
size(1100, 800, P2D);
smooth();
background(150);
if (play) {
for (int i = 0; i<fileList.length; i++)
{
images = loadImage(path + "/" + fileList[i]);
} //filters through images
}
noStroke();
fill(0, 0, 0, 150);
rect(0, 0, screen.width, 645);
noStroke();
fill(0, 0, 0, 150);
rect(0, 0, 140, height);
toolBar2 = loadImage("cita495/toolBar2.jpg");
toolBar2.resize(width, 75);
image(toolBar2, 0, 725);
toolBar = loadImage("cita495/toolBar.jpg");
toolBar.resize(width, 65);
image(toolBar, 0, 655);
eyeSlide = loadImage("cita495/eyeSlide.jpg");
eyeSlide.resize(140, 145);
image(eyeSlide, 0, 655);
G4P.setFont(this, "Arial", 12);
sensLbl = new GLabel(this, "Beat Sensitivity", 155, 740, 285);
sensLbl.setTextAlign(GAlign.CENTER);
senseSlider = new GWSlider(this, 155, 770, 285);
senseSlider.setValueType(GWSlider.DECIMAL);
senseSlider.setLimits(50f, 0f, 400f);
senseSlider.setTickCount(15);
senseSlider.setRenderMaxMinLabel(false); //hides labels
senseSlider.setRenderValueLabel(false); //hides value label
playBox = loadImage("cita495/playBox.jpg");
playBox.resize(800, 520);
image(playBox, 165, 10);
btnPlay = new GButton(this, "CITA495/btnPlay.png", 15, 315, 115, 506, 300);
btnPlay.tag = "playBtn";
btnPics = new GButton(this, "CITA495/btnImgFolder.png", 3, 460, 750, 140, 36);
btnPics.tag = "photos";
btnMusic = new GButton(this, "CITA495/btnMusic.png", 3, 615, 750, 36, 36);
btnMusic.tag = "music";
btnStop = new GButton(this, "CITA495/btnStop.png", 50, 665, 750, 36, 36);
btnStop.tag = "Pause";
btnPlay2 = new GButton(this, "CITA495/btnPlay2.png", 50, 715, 750, 36, 36);
btnPlay2.tag = "Play";
btnColor = new GButton(this, "CITA495/btnColor.png", 3, 765, 750, 36, 36);
btnColor.tag = "Restore Color";
btnBW = new GButton(this, "CITA495/btnBW.png", 3, 815, 750, 36, 36);
btnBW.tag = "Black and White/Gray Scale";
btnBubbles = new GButton(this, "CITA495/btnBubbles.png", 3, 865, 750, 36, 36);
btnBubbles.tag = "Background Bubble Lights";
btnStripes = new GButton(this, "CITA495/btnStripes.png", 3, 915, 750, 36, 36);
btnStripes.tag = "Background Stripes";
btnShade = new GButton(this, "CITA495/btnShade.png", 3, 965, 750, 36, 36);
btnShade.tag = "Background Shades";
btnVisual = new GButton(this, "CITA495/btnVisual.png", 3, 1015, 750, 36, 36);
btnVisual.tag = "Background Visualizer";
}
void draw()
{
totalTime += 1;
if(abs(speed2)>1){
t = t*-1;
}
sensitivity = senseSlider.getValue();
if (imgShowOn) {
fileList = loadFilenames(path);
}
if (play && song != null && imgShowOn) {
filler = 8;
fill(0, filler);
rect(0, 0, screen.width, screen.height-145);
toolBar2 = loadImage("cita495/toolBar2.jpg");
toolBar2.resize(width, 75);
image(toolBar2, 0, 725);
btnPlay.setVisible(false);
if (btnPlay.isVisible() == false) {
randDisplay();
move();
if (visualOn) visualizer();
if (stripesOn) backDisplay();
if (bubblesOn) backDisplay2();
if (shadeOn) backDisplay3();
// backDisplay3();
if ((beat.isKick() && totalTime>sensitivity) || (beat.isHat() && totalTime>sensitivity) || (beat.isSnare() && totalTime>sensitivity )) {
imageIndex = (imageIndex+1) % fileList.length;
move = 1;
move2 = 1;
totalTime=0;
sFade=.01;
if (imageIndex+1==fileList.length) imageIndex=0;
}
if (stop) {
restart();
}
}
}
}
String[] loadFilenames(String path) {
if (path != null) {
File folder = new File(path);
FilenameFilter imgFilter = new FilenameFilter() {
public boolean accept(File dir, String name) {
String lowCase = name.toLowerCase();
return lowCase.endsWith(".jpg")
|| lowCase.endsWith(".png")
|| lowCase.endsWith(".tif")
|| lowCase.endsWith(".tga");
}
};
return folder.list(imgFilter);
}
else {
return null;
}
}
//
void restart() {
if (restart == true) {
{
song.pause();
filler = 0;
print("PP pressed and variables reset");
if (play) {
// always stop Minim before exiting
minim.stop();
play = false;
}
}
restart = false;
}
}
void visualizer() {
{
loadPixels();
//upper screen visualizer
if (song==null) print("Song has incorrect Extension");
else {
for (int i = 0; i < song.bufferSize() - 1; i+=20)
{
stroke(random(0, 255), random(125, 222), random(15, 172), 150);
//pull the samples from the mix channel, multiply by 150 to make them visible
line(i, 70 + song.left.get(i)*150, i+1, 85 + song.left.get(i+1)*250);
}
for (int i = 5; i < song.bufferSize() - 1; i+=20)
{
stroke(random(115, 172), random(10, 172), 100, 150);
line(i, 70 + song.right.get(i)*150, i+1, 85 + song.right.get(i+1)*250);
}
for (int i = 0; i < song.bufferSize() - 1; i++)
{
stroke(251, random(200, 52), 251, 5);
line(i, 70 + song.left.get(i)*50, i+1, 75 + song.left.get(i+1)*200);
}
//lower screen visualizer
for (int i = 0; i < song.bufferSize() - 1; i+=20)
{
stroke(random(0, 255), random(15, 222), random(15, 72), 150);
line(i, 650 + song.left.get(i)*100, i+1, 655 + song.left.get(i+1)*200);
}
for (int i = 5; i < song.bufferSize() - 1; i+=20)
{
stroke(random(115, 172), random(10, 172), 100, 150);
line(i, 650 + song.right.get(i)*100, i+1, 655 + song.right.get(i+1)*200);
}
for (int i = 0; i < song.bufferSize() - 1; i++)
{
stroke(251, random(200, 52), 251, 5);
line(i, 650 + song.left.get(i)*50, i+1, 655 + song.left.get(i+1)*200);
}
}
}
}
eyeSlide is a slideshow creator. Choose from any MP3 you have and select a folder containing images. Click on any of the buttons to change the appearance of the slideshow