Message Boards Message Boards

1
|
4796 Views
|
0 Replies
|
1 Total Likes
View groups...
Share
Share this post:

Animating Scrollbars for Image Galleries

Posted 11 years ago
I'd like to be able to show a huge number of graphics to people quickly, I know about ListAnimate but that only shows one image at a time
ListAnimate[countryMaps=(CountryData[#, "Shape"] & /@ CountryData[])[[1;;100]]]

Pane has the option Scrollbars, that allows me to flash through the images with a Scrollbar:
Pane[Grid[{countryMaps}, ItemSize -> All], {700, 300}, Scrollbars -> True]

I've found the option ScrollPosition but at the moment I need to Rasterize my Grid (or other content holder) to find out how large it is:
DynamicModule[{horizPost = 0}, Column[{Slider[Dynamic[horizPost], {0, 700}],Dynamic@Pane[Grid[{countryMaps}, ItemSize -> All],ImageSize -> {700, 300}, Scrollbars -> True, ScrollPosition -> {horizPost}], Dynamic[horizPost]}]]

And with some guidance found Animator to control how quickly the Pane is scrolled through:
DynamicModule[{horizPost = 0, size = Options[Rasterize@Grid[{countryMaps}, ItemSize -> All],ImageSize][[1, 2, 1]]}, Column[{Animator[Dynamic@horizPost, {0, size - 700}, (size - 700)/4, AppearanceElements -> {"PlayPauseButton"}, AnimationRunning -> False],Dynamic@Pane[Grid[{countryMaps}, ItemSize -> All], ImageSize -> {700, 300}, Scrollbars -> {True, False},ScrollPosition -> {horizPost}],Dynamic[horizPost]}]]

This works, and looks relatively flashy, but I don't like having to Rasterize my content to limit ScrollPosition. Rasterize quickly runs out of memory on my machine for large objects, and I'm worried about it making bad decisions about Styles if I put this functionality into a package. So my questions are two fold:
  1. Is there another way to find an appropiate range for ScrollPosition?
  2. Any suggestions for improving performance/appearance?
POSTED BY: Martin Hadley
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract