PongGal — a Photo Gallery Player.

Operation Notes — Ver 1.0

PongGal is an in-browser Image Gallery Player, written in Javascript. It is intended for use with sequences of images that form an animation, or structure. For instance, medical imagery slices.

For these types of image sequences, there's a need to be able to very easily animate ranges within the sequence, going forward or back, looping (skip back to start) or 'ping-pong' shuttling back and forth in the selected range. In the minimal case of two images, it's called blink comparison.

This Gallery Player is intended for use where all the image files exist in local storage. It does no prefetching of images. For one thing, because often in medical image stacks there are hundreds of fairly large images, and prefetching just isn't going to help. This utility absolutely will not work over an Internet connection. It also is unlikely to work acceptably with images stored on a CD/DVD disk.

Controls

RUN/STOP In RUN mode the images cycle through the selected range, and the SLOW and FAST buttons alter the speed about 20% with each click.

PONG/LOOP This sets the repeat mode. In LOOP the display jumps back to the other end of the series when it reaches either end. In PONG it shuttles back and forth between the selected end points.

REVR is 'Reverse direction'. This only makes sense in LOOP mode, so it's grayed out in PONG mode. It allows the image stack to be displayed in forward or reverse order.

STEP allows manual incrementing of the image number when stopped. It works in PONG and LOOP, and goes in the direction set via REVR. Note that RUN-PONG mode has its own direction flag, and doesn't alter the 'manual' one. STEP doesn't make sense in RUN mode, so it's grayed out.

FIRST and LAST are available while in STOP, allow resetting of the selection endpoints to the lower and upper bounds of the image set, as displayed in the left and right numeric fields. They also set the current image index to the low or high bound, and the scan direction away from the set end.

SLOW and FAST are present during RUN mode. Mouse clicks on these alter the rate of image incrementing, by about 20% with each click. There's no precise speed control, you just click them enough to get about the speed you want. The speed setting is retained during STOP.

1 23 50
The three numeric fields are: Play selection low endpoint, current image #, and play selection high endpoint.
Clicking on the left or right field at any time sets that field to the current image index (center field), even in RUN mode. Since the center field can be altered with the RUN, REVR, STEP, FIRST and LAST buttons, this allows the endpoints to be set easily enough too, without requiring a numeric entry. (Might add that later.)

If you make the endoints equal, obviously there's nothing to animate, and RUN will drop back to STOP.
If there are only two images selected, it serves as a blink comparator. The rate is variable too.
The code sets hard limits on the image shuffling rate of 10 mSec to 1 Sec between image changes. If you set the rate faster than your PC can redraw large images, you'll see stuttering. Slow down the refresh rate to avoid this.

Distribution

This software is freeware. Anyone may copy, use and modify any of it as they like.
Source: http://everist.org/NobLog/20150424_js_animated_gallery.htm
All source code is in the one file, just open in an editor.
A zipfile of the button images is here. (42K) Also contains an Operation Guide. (7K)
Photoshop file of the large size button art. (877K)
Demo with a 79 image series. (11MB)

Yes, I know the Javascript coding style is primitive, no need to tell me this. It's been a long, long time since I wrote any code.

The files PongGal reads must all be in one folder, and have names containing a sequential numeric field. Like "file024.png" for instance. The numbers can have leading zeros with a fixed number of digits, or be normal (no leading zeros.) I always number such files with a fixed number of digits and leading zeros, so they sort sensibly in directory listings.

All config values are in the Javascript constants code section.

The name comes from the early computer game Pong (an abbreviation of Ping Pong.) I needed a four letter word that conveyed the 'shuttle' back and forth action. Ping Pong Gallery. Hence PongGal. Perhaps I'll think of a less stinky name later. 'Pongle' is completely out. Google it.