Hi everyone,
I have been attempting a sketch, which scrolls through images, each image has an 2 more images placed both on top and below it ( visually similar to how an instagram post will have the username/profile photo above and a like/comment/save below).
I have got as far as creating a sketch which does this for one image at a time, once the image is out of frame the following image will be displayed, I would like the images to instead roll continuously without the background showing in between each time the image is displayed.
On one of the forums I found a guide achieving something similar to what I am attempting, the only issue is my images have a fixed width but varying heights between them, something this code requires to be fixed:
Does anyone have an what a better approach might be?
String l=dataPath("/Users/ollie/Desktop/img");
PImage[] img = new PImage[50];
PImage top, bot;
float m;
float tH, bH, iH, fH;
int j = 0;
void setup() {
size(500, 500);
imageMode(CORNER);
top = loadImage("dftFriendTop.png");
bot = loadImage("dftFriendBot.png");
}
void imgLoad() {
img[j] = loadImage(l+"//"+"imgr"+j+".jpg");
tH = top.height;
bH = bot.height;
}
void draw() {
imgLoad();
background(255);
iH = img[j].height;
image(top, 0, m - iH - tH);
image(img[j], 0, m - iH);
image(bot, 0, m - bH);
m = m - 5;
fH = tH + iH + bH;
if (m < 0) {
m = (fH + height);
j = j + 1;
}
if (j >= 50) {
j = 0;
}
}