www.trainplayer.com SupportNewsAboutContact
      HOMEPRODUCTS  TRACK PLANS     NEWSLETTER     FRIENDS
Animated Images in TrainPlayer 4.0.3 -- July 2011 Contents

Animated images in TrainPlayer are little movies you can place around your layout. These can be made to play continuously, or on demand, or automatically whenever a train passes a given spot. You can choose from a supplied collection of animations (small but growing), or find many more by searching the web, or create them in your favorite paint program. They can be connected with sounds, so that, say, a crossing signal will both move and clang as the train passes by.

To see animations in action, check out this video:

About Animated Images

An animated image is a new type of scenery object. It can be moved, resized, rotated, and styled just like any other, but it has a special type of background consisting of a series of frames, each with its own image and duration. These are in one of two formats:

Animated gif: the well-known animation files you see all over the web.  These can be loaded directly into scenery objects in TrainPlayer.

Image sequence / ANM file: a series of separate files for each image, plus a text file with extension ".anm," listing the frames and durations. The image files may be in any popular graphics format -- bmp, png, jpg, gif -- and the simple text file can be created by the program or by hand. This scheme was designed to make it easy for users to create their own animations.

Because animated images are tied to scenery, creating and manipulating them requires TrackLayer with Scenery Toolkit.  Viewing and playing them in an existing layout can be done in TrainPlayer [except: in the current version, you cannot start or stop animation if you don't have access to the scenery toolbar.]

Triggers:  events which cause animations to start and stop. We have in mind a variety of these, but for the time being there are only two:

Station trigger: animation starts when the lead car of a train (any train) enters a given station, and stops when the last car leaves.  This is the same scheme which controls sounds attached to stations, so if you want a sound to play at the same time the animation moves, use a station trigger on the animation, and specify a sound on the same station.

Junction trigger:  animation starts when the lead car of a train crosses a given junction, and ends when the last car crosses it.

Triggers are specified using the Scenery Properties Animation tab, as described below.

Adding Animation to Your Layout

There are two ways to add animated images to your layout: from the Scenery Chooser, or via Load Bitmap.  The first is easier, the second more flexible.

Using the Scenery Chooser

The initial release of 4.0.3 comes with a small set of sample animations in both gif and anm formats. More are available (or soon will be) in the web scenery collections.  To add one of these to your layout:

1.  Bring up the Scenery Chooser using Tools > Scenery > View Scenery Chooser or the button on the scenery toolbar.

2.  Click to open the new animations folder. (If you don't see it, try right-clicking the Scenery folder and choosing Refresh.)

3.  Press an image and drag onto the layout.  That's it -- it starts playing immediately.  (To stop, use the Scenery Edit tool, right-click and choose Stop Animation.)

Confession: most of the animations in our sample set came from the Microsoft Office Online clip-art collection.  There do not appear to be restrictions on distributing these, unless we missed some fine print.

Using Load Bitmap

The alternative to loading an image from the chooser is to create the scenery object first and then attach the image.  The procedure is the same as when adding a non-animated image, as follows:

1.  Select the Rectangle tool on the scenery toolbar, and drag to create a rectangle where you want the animated image.  By default this gets a beige background.

2. Select the Scenery Edit tool (green arrow), right-click the new rectangle and choose Load Bitmap.  You get a standard file dialog.

This is the same dialog you use for static background images.  It is still used for that, but now supports three more types of input:

a. Browse to an anm file -- the program will create an animated image.

b. Browse to a gif file -- the program will examine it and decide whether to create an animated or static image.

c. Browse to the first of a series of images -- the program will create an animation and anm file automatically.  This process is described in detail below.

Once you successfully load an animated image, you get an alert confirming the import and reporting the number of frames.

An animated image created using Load Bitmap does not automatically start playing upon creation.  To start it, use the Scenery Edit tool, right-click the image and choose Start Animation.

Working with Animated Images

Animated images work basically like other scenery objects. 

To manipulate:  Use the Scenery Edit tool (green arrow on the scenery toolbar), click to select an image, then you can move, resize, rotate, and restyle it as usual.  It keeps animating as you move it around.

By default, an animated image has its proportions locked, so resizing the image will not distort it.  To rotate an image, drag the handle at its upper right.

To stop or start animation: select the Scenery Edit tool, right-click the image and choose Stop Animation or Start Animation, as shown ==>

Once you start an object moving, it keeps going until you stop it, or until a trigger event causes it to stop.  If you save the layout while the object is animating, it will come back that way the next time you open the layout.

To set object properties: select, right-click and choose Properties.  Most properties of standard scenery objects apply to animated ones.

To trigger animation on train moves: see the following section.

Animated Image Properties

To view or adjust properties of an animated image, right-click on it (using the Scenery Edit tool) and choose Properties.  The Scenery Properties dialog appears, showing the new Animation tab.

This dialog is modeless -- it remains up while you work on the layout.  You can select different objects on the layout and adjust their properties one at a time, or shift-click to select multiple objects and set all their common properties at once.

Controls on the Animation tab:

Type: Animated gif file vs Image series/anm file.  This is read-only -- you can't change the type in this dialog.

Frames: number of frames in the animation.  Read-only.

Frames button:  click to bring up the Frames dialog, showing filenames and durations in a little grid:

If the animation type is anm, then you can edit the values in this grid; for animated gifs, the data is uneditable [in fact, for the time being, the Frames button does nothing at all if you are dealing with gif rather than anm].

Times are in milliseconds.  Filenames can be changed -- they need not be numbered sequentially once they have been listed in an anm file -- but they must exist and all be in the same folder as the anm file.

This dialog appears automatically whenever you import a sequence of image files.

Playing:  check or uncheck to start or stop animation.  The setting does not take effect until the dialog comes down.

Play once:  check if you want the animation sequence to play once and then stop, instead of repeating continuously.  This applies whether you start the animation manually from the context menu or automatically based on a trigger.

Rewind after play:  check if you want the image to revert to its first frame after every play.  If you do not check this box, then stopping the animation will freeze it, and starting it later will pick up where it left off.  [Note: due to a bug in the current version, you may need a View Refresh to update the image so it will go back to its first frame.]

Trigger type drop-down:  choose a trigger action, or None.  At the moment there are two actions available: when a train passes through a station, or when it crosses a junction.

Trigger id drop-down:  choose the station name or junction id where animation is to start and stop.  The drop-down shows either station names or junction numbers, depending on the trigger type choice.

Preview window:  shows a thumbnail of the selected image.  For the moment, the preview is static and does not move, but this may change in a future version.

Normally in the Background tab of Scenery Properties, you can choose a different image for a scenery object.  However, what you cannot do is change the background from static to animated, or vice-versa.  If you try this, an alert tells you it is not allowed.

Creating Your Own Animations

If you want to create your own animations, one method is to obtain a program capable of making animated gifs.  Many such programs are available -- Adobe ImageReady, CyD GIF Studio, Microsoft GIF Animator, several shareware titles -- but TrainPlayer offers an easier way: create a series of images, give them suitable filenames, and import them with one click into a single object.

A series of images is a set of files in the same folder with names ending in underscore, then sequential numbers starting with 1; e.g., flagman_1.png, flagman_2.png, flagman_3.png. Using Load Bitmap, if you browse to a file whose name ends with "_1," and there are other files with the same name but different numbers, the program will prompt and ask if you wish to create an animated image from the series, like this:

Click Yes, and the program will create a file with the name of the series and extension.anm (e.g., flagman.anm), then load it into the scenery object.

When you create an animated image from a series of files, the Frames dialog (shown above) comes up so you can set the frame timings.  By default, all are set to 100 ms.

After a successful load, an alert informs you of the number of frames, and the output anm filename if applicable:

If you create an anm file from a series of images, and want it to appear in your Scenery Chooser, copy the anm file and all the component image files to your Scenery\animation folder.  Note that the chooser will display only the anm file, not any of its components.

If you create an animation sequence and want to send it to us or to a friend, zip the entire set of images, along with the anm file, and send the zip.

If you have an animated gif, and you want to modify it, you will need to split it into separate frame files. TrainPlayer has the ability to do this; in fact, it does this job whenever you read in an animated gif -- the gif is split into frames, which are saved in your Windows Temp directory.  You can capture these and use them to make your own animation sequence.  For details, send e-mail and request information.

Trying It Out

A test runfile with the animation feature is about ready to download.  Instructions will appear on the TrainPlayer Forum.

We hope you enjoy animated images. 


About Animated Images

Adding Animation to Your Layout

Working with Animated Images

Animated Image Properties

Creating Your Own Animations


Trying It Out

  Copyright 2005 - 2014, TrainPlayer Software