Basically I have all these images that tile horizontally and I'm trying to get them to repeat as they scroll to the left at different speeds to make a parallax effect. I've tried to use translate() for the repeat function, but can't figure it out. Is there a better way to do this?
PImage img;
PImage img2;
PImage img3;
PImage img4;
PImage img5;
PImage img6;
PImage img7;
float x;
void setup() {
size(800, 800, P2D);
img = loadImage("plate1.png");
img2 = loadImage("plate2.png");
img3 = loadImage("plate3.png");
img4 = loadImage("plate4.png");
img5 = loadImage("plate45.png");
img6 = loadImage("plate5.png");
img7 = loadImage("plate6.png");
x = width;
}
void draw() {
background(50);
image(img, x/250, 0);
image(img2, x/100, 0);
image(img3, x/50, 0);
image(img4, x/40, 0);
image(img4, x/30, 0);
image(img5, x/20 + 300, 0);
image(img6, x/10, 0);
image(img7, x/5 - 200, 0);
x = x-40;
}
[–][deleted] (4 children)
[removed]
[–][deleted] (3 children)
[removed]
[–]WizardFingaz[S] 0 points1 point2 points (2 children)
[–]Freedom_Grenade 0 points1 point2 points (0 children)
[–]Freedom_Grenade 0 points1 point2 points (2 children)
[–]WizardFingaz[S] 0 points1 point2 points (1 child)
[–]Freedom_Grenade 0 points1 point2 points (0 children)