several slideshows
Answered
- Need more info
- Answered
- Working on it
in
Programming Questions
•
2 years ago
hi there,
i am trying to do the following:
i want to have three slideshows (with the same pcitures) on one stage.
on keypress (or mousepress) the first one starts. on the next keypress it stops at the current picture and triggers the next one to begin. next keypress this one pauses, third one begins.
so in the end i have three pictures. i would export that as jpg and start again.
i tried to come up with something using the "Slide_show_with_one_PImage" technique, but it doesnt really work.
the second and the third slideshow do not work:
i think its not a good piece of code at all, and propably the wrong start, but i'm still pretty new to processing...
thank you very much in advance!
mpod
.
i am trying to do the following:
i want to have three slideshows (with the same pcitures) on one stage.
on keypress (or mousepress) the first one starts. on the next keypress it stops at the current picture and triggers the next one to begin. next keypress this one pauses, third one begins.
so in the end i have three pictures. i would export that as jpg and start again.
i tried to come up with something using the "Slide_show_with_one_PImage" technique, but it doesnt really work.
the second and the third slideshow do not work:
- PImage img;
String[] files;
int timer;
int nextimg;
PImage img2;
String[] files2;
int timer2;
int nextimg2;
PImage img3;
String[] files3;
int timer3;
int nextimg3;
int a=1;
void setup() {
size(1754,1240);
files=new String[3]; //some example images.
files[0]="medium.jpg";
files[1]="small.jpg";
files[2]="big.jpg";
nextimg=(nextimg+1)%files.length;
img=loadImage(files[nextimg]);
timer=0;
//next slideshow
files2=new String[3]; //some example images.
files2[0]="medium.jpg";
files2[1]="small.jpg";
files2[2]="big.jpg";
nextimg2=(nextimg2+1)%files2.length;
img2=loadImage(files2[nextimg2]);
timer2=0;
//next slideshow
files3=new String[3]; //some example images.
files3[0]="medium.jpg";
files3[1]="small.jpg";
files3[2]="big.jpg";
nextimg3=(nextimg3+1)%files3.length;
img3=loadImage(files3[nextimg3]);
timer3=0;
}
void draw() {
if(a==1){
if(timer==0)
{
background(255);
image(img,30,30);
}
else if(timer==1)
{
img=loadImage(files[nextimg]);
nextimg=(nextimg+1)%files.length;
delay(50); //this decides how long an image should be displayed
}
timer=(timer+1)%2;
}
if(a==2){
if(timer2==0)
{
background(255);
image(img2,500,500);
}
else if(timer2==1)
{
img=loadImage(files2[nextimg2]);
nextimg2=(nextimg2+1)%files2.length;
delay(50); //this decides how long an image should be displayed
}
timer2=(timer2+1)%2;
}
if(a==3){
if(timer3==0)
{
background(255);
image(img3,1000,500);
}
else if(timer3==1)
{
img=loadImage(files3[nextimg3]);
nextimg3=(nextimg3+1)%files2.length;
delay(50); //this decides how long an image should be displayed
}
timer3=(timer3+1)%2;
}
}
void mousePressed() {
if(a<3){
a=a+1;
}
else {
a=1;
}
}
i think its not a good piece of code at all, and propably the wrong start, but i'm still pretty new to processing...
thank you very much in advance!
mpod
.
1