ListAnimate with controls like slideshows

It may be abuse of ListAnimate, but I use it to flip through a bunch of images. When there are enough images, I can capture the slider with the mouse and easily flip back and forth among the images.

But when too much is very difficult to flip them one by one. Is there a way to just use the arrow keys (or any keys) to fast-forward and rewind images, like a slide show?

+4
source share
3 answers

Here's a simple slideshow with a controlled keyboard:

SlideShow[list_List] := With[{len = Length[list]}, DynamicModule[{pos = 1}, EventHandler[Dynamic[Pane[list[[pos]]]], {"RightArrowKeyDown" :> (pos = Mod[pos + 1, len, 1]), "LeftArrowKeyDown" :> (pos = Mod[pos - 1, len, 1]), "UpArrowKeyDown" :> (pos = 1), "DownArrowKeyDown" :> (pos = len)}]]] 

Then you control the slide show by selecting the output and using the arrow keys:
right = forward, left = back, up = first, down = last,

For instance:

 SlideShow[{"a","b","c","d"}] 

Some sample images:

 pics = ExampleData /@ ExampleData["TestImage"][[{1, 2, 3, 4}]] SlideShow@pics 

(* Imagine a screen capture here *)

It can be dressed to give it a frame, buttons, etc.

+4
source

I just noticed that SlideView or FlipView will do exactly what I want! (Except that none of them offer keyboard controls, which would be very nice.)

+2
source

The following also works:

 DynamicModule[{i = 1}, EventHandler[SlideView[{a, b, c, d}, Dynamic[i]], {"RightArrowKeyDown" :> (i = Min[i + 1, 4]), "LeftArrowKeyDown" :> (i = Max[i - 1, 1])}]] 
+2
source

All Articles