[NEWBIE] Wrap around image (sccroller?)
in
Programming Questions
•
1 year ago
I'm trying to get this film strip graphic to continusly wrap around the top and not stop after 1 revolution.
I tried duplicating the graphics and starting them further over but that doesn't work. How do I get around this? :(
Here is my code:
PImage h, h1, h2, h3;
int t;
void setup(){
size(750, 400);
smooth();
h = loadImage("topbanner.jpg");
h1 = loadImage("bottombanner.jpg");
h2 = loadImage("topbanner.jpg");
h3 = loadImage("bottombanner.jpg");
t = -h.width;
}
void draw(){
background(255);
image(h, t, 0);
image(h1, t, 350);
image(h2, t+750, 0);
image(h3, t+750, 350);
t += 10;
if(t > width) t = -h.width;
}
int t;
void setup(){
size(750, 400);
smooth();
h = loadImage("topbanner.jpg");
h1 = loadImage("bottombanner.jpg");
h2 = loadImage("topbanner.jpg");
h3 = loadImage("bottombanner.jpg");
t = -h.width;
}
void draw(){
background(255);
image(h, t, 0);
image(h1, t, 350);
image(h2, t+750, 0);
image(h3, t+750, 350);
t += 10;
if(t > width) t = -h.width;
}
Thanks very much for your help :)
1