We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hi all,
I am looking for ways to do scrolling slides. Say, I had a series of gif images or png images as frames. and as I slide down, those images will be loaded, working like an animation. I been searching on this Forum threads, but not really worked out. Any ideas? Thanks for your time on this.
Answers
Do you mean moving the mouse?
You could do this with a simple PImage[] array, but it sounds like it might be a job for a Sprite class or a Sprite library.
Not sure what you mean...
Like a cover flow....?
https://en.wikipedia.org/wiki/Cover_Flow
Ah, I misread the question -- I thought you wanted a frame that changed (animated) as you slid it back and forth across the screen -- like the apple in Dr. Strange.
If you want scrolling images, like Cover Flow, see this recent discussion:
https://forum.processing.org/two/discussion/23134/moving-images-from-an-array-across-the-screen
@jeremydouglass @Chrisir thanks for this. So what I mean by sliding was, just like scrolling down pdf slides. I can scroll down and up the mouse scroll, and images are loaded
So they are displayed one below each other and when you scroll, two inages are visible simultaneously or instant change from one image to another ?
As I said, see this thread for image scrolling:
https://forum.processing.org/two/discussion/23134/moving-images-from-an-array-across-the-screen
How many images are you dealing with? The easiest thing is to load all images during setup, but if you want to implement lazy loading of a very large collection of images then you will need to do a bit more work.
@Chrisir So yeah, basically instant change from one to another. @jeremydouglass I'm dealing with abt 300 images here..
Then you want the lazy loading design pattern. Based on the scrolling offset and scrolling direction, load PImage indexes that fall into the matching range. The matching range should be wider than your screen so that images load before they reach the screen.
Once you reach a loaded maxImageCount (eg 20) you also may want to start dropping loaded I mages from the farthest end of the list so that Java can reclaim the memory.