random sliding movement help
in
Programming Questions
•
1 year ago
Hi
I am very much a beginner with processing by all means. I really need help with this project where i am trying to flick across random positions on a filmstrip (which is essentially one long .jpg sliding across) by clicking the mouse. So far i have been able to get the strip moving but when i click it only shows the random sections for a single frame. i really want the effect of the strip moving then landing in the random spot while continuing to move.
this is what i have:
PImage img3;
PImage img2;
float y,x;
float speed=0.1;
//SETUP- ALL OF THE IMAGES
void setup(){
size(678,598);
img2= loadImage("FILM.jpg");//FILMSTRIP THAT WILL BE MOVING
img3= loadImage("tv.png");//FRONT IMAGE BLOCKING FILMSTRIP
}
void draw(){
background (0);
//MOVING THE FILMSTRIP
pushMatrix();
translate(x,y);
x+=0.5;
image(img2,-23100,0);
popMatrix();
image(img3,0,0);
}
void mousePressed() {
if(x> -23100) {
pushMatrix();
translate(x,y);
x+=0.5;
image(img2,x,0);
x= random(-23100,678);
popMatrix();
image(img3,0,0);
}
}
ANY help would be so greatly appreciated!!!!!!
I am very much a beginner with processing by all means. I really need help with this project where i am trying to flick across random positions on a filmstrip (which is essentially one long .jpg sliding across) by clicking the mouse. So far i have been able to get the strip moving but when i click it only shows the random sections for a single frame. i really want the effect of the strip moving then landing in the random spot while continuing to move.
this is what i have:
PImage img3;
PImage img2;
float y,x;
float speed=0.1;
//SETUP- ALL OF THE IMAGES
void setup(){
size(678,598);
img2= loadImage("FILM.jpg");//FILMSTRIP THAT WILL BE MOVING
img3= loadImage("tv.png");//FRONT IMAGE BLOCKING FILMSTRIP
}
void draw(){
background (0);
//MOVING THE FILMSTRIP
pushMatrix();
translate(x,y);
x+=0.5;
image(img2,-23100,0);
popMatrix();
image(img3,0,0);
}
void mousePressed() {
if(x> -23100) {
pushMatrix();
translate(x,y);
x+=0.5;
image(img2,x,0);
x= random(-23100,678);
popMatrix();
image(img3,0,0);
}
}
ANY help would be so greatly appreciated!!!!!!
1