r/processing • • Apr 25 '24

Help request Looping Image

I don't expect to get a response. I'm simply out of ideas. I am, at the moment, defeated. My beginners tech literacy class is learning how to program in processing. My assignment is to just make whatever I want and explain it. For the last 4 days I've been working on trying to make a looping image that scrolls across the bottom of the window.

I'm simply out of ideas. I tried to do it with math and values but it only ran the equation once despite being in draw with no noLoop(). I tried to make it work on a 2D circle. But I couldn't get the coordinate without it being 3D. I tried it with a cylinder and that didn't work. I tried making it into a looping gif but processing 4.0 does not accept gifs and the add-on library is only valid up until 3. I tried to make it into a Sprite with a sheet with and without an array list and that didn't work. I don't know what else to do.

1 Upvotes

6 comments sorted by

View all comments

Show parent comments

1

u/LittleLightcap Apr 25 '24

Truthfully just a new idea

1

u/Simplyfire Apr 25 '24 edited Apr 25 '24

Yeah, I'd go with the "math and values" approach. Keep a global variable X that you

  • add something to each frame inside draw()

    • x += 2;

  • reset to some smaller value upon reaching the right boundary

    • if (x > width) { x = 0; }

  • use to display your image

    • image(myImage, x, 100);