Name
ANIM -- preload an animation for later use (V2.0)
Synopsis
@ANIM id, filename$[, table]
Function
This preprocessor command preloads the animation specified in filename$ and keeps it under the identifier id.

Anim formats that are supported on all platforms are IFF ANIM, GIF ANIM, AVI (uncompressed or using Motion JPEG compression), and formats you have a plugin for. Depending on the platform Hollywood is running on, more anim formats might be supported. For example, on Amiga compatible systems Hollywood will be able to open all anim formats you have datatypes for as well.

Starting with Hollywood 4.5, @ANIM can also automatically create animations from an image file. If you want to use an image file with @ANIM, you need to specify the optional Frames argument. See below for more information.

The third argument is optional. It is a table that can be used to set further options for the loading operation. The following fields of the table can be used:

Transparency:
This field can be used to specify a color in RGB notation that shall be made transparent in the animation.

Link:
Set this field to False if you do not want to have this animation linked to your executable/applet when you compile your script. This field defaults to True which means that the animation is linked to your to your executable/applet when Hollywood is in compile mode.

FromDisk:
If you set this field to True, Hollywood will not load the whole animation into memory but it will load the single frames directly from disk when needed. This is slower but requires much less memory. For the functions of the anim library it does not matter whether the animation is completely in memory or loaded dynamically from disk. You can use all anim functions like ScaleAnim() also with anims that are loaded from disk. Anim layers are also correctly handled with disk anims. (V3.0)

LoadAlpha:
Set this field to True if the alpha channel of the anim shall be loaded, too. Please note that most anim formats do not support alpha channels. Thus, it is advised that you create the anim manually from a PNG picture using CreateAnim() if you need to have an alpha channel in your animation. This field defaults to False. (V4.5)

X, Y, Width, Height, Frames, FPR:
This group of fields is only used when you specify an image file source. In that case, you have to use these arguments to tell @ANIM how it shall create the animation from the image. Width and Height define the dimensions for the animation and Frames specifies how many frames @ANIM shall read from the source image. If the frames are aligned in multiple rows in the source image, you will also have to pass the argument FPR (abbreviation for frames per row) to tell @ANIM how many frames there are in each row. Finally, you can tell @ANIM where in the image file it should start scanning by specifying the fields X and Y (they both default to 0). @ANIM will then start off at position X and Y and read Frames number of images with the dimensions of Width by Height from the picture specified by filename$. After it has read FPR number of images, it will advance to the next row. (V4.5)

SkipLoopFrames:
If you set this to True, Hollywood will automatically skip the last two frames of the anim. This is only required for IFF ANIMs that have two loop frames at the end of the anim. Auto detection of loop frames is not possible because it would require Hollywood to decode the whole anim first. That is why you have to tell Hollywood manually whether the anim has loop frames or not. (V5.3)

Deinterlace:
This tag allows you to specify how Hollywood should deinterlace interlaced anims. This can be set to either #DEINTERLACE_DEFAULT or #DEINTERLACE_DOUBLE. If set to #DEINTERLACE_DEFAULT (which is as the name implies also the default), Hollywood will combine two half-frames into one full frame. This mostly results in the best quality but can lead to visual artefacts when there is a lot of movement in the anim. If you use #DEINTERLACE_DOUBLE instead, Hollywood will double the lines of a half-frame to get a full frame. This leads to some quality loss but can make the anim look more smooth. The best deinterlace mode to use always depends on the anim. Note that mostly you should not have to care about this tag at all because deinterlacing is actually only required for some obscure IFF ANIM formats which store interlaced frames like ANIM16i and ANIM32i. (V5.3)

Loader:
This tag allows you to specify one or more format loaders that should be asked to load this anim. This must be set to a string containing the name(s) of one or more loader(s). Defaults to default. See Loaders and adapters for details. (V6.0)

Adapter:
This tag allows you to specify one or more file adapters that should be asked to open the specified file. This must be set to a string containing the name(s) of one or more adapter(s). Defaults to default. See Loaders and adapters for details. (V6.0)

LoadTransparency:
If this tag is set to True, the monochrome transparency of the anim will be loaded. Please note that this tag is specifically designed for monochrome transparency channels, i.e. a transparent pen in a palette-based anim. If you want to load the alphachannel of an anim, set the LoadAlpha tag to True. This tag defaults to False. (V6.0)

Please note that the Transparency, LoadTransparency and LoadAlpha fields are mutually exclusive. An animation cannot have a mask and an alpha channel!

If you want to load anims manually, please use the LoadAnim() command.

Inputs
id
a value that is used to identify this animation later in the code
filename$
the animation file you want to load
table
optional: a table that can contain a combination of the fields discussed above
Example
@ANIM 1, "MyAnim.gif"
Load "MyAnim.gif" as animation number 1.


@ANIM 1, "MyAnim.gif", {Transparency = $FF0000}
Does the same like above but the animation is now transparent (transparency color is red=$FF0000).


@ANIM 1, "Huge_Animation.iff", {Link = False}
The code above loads the specified animation and tells Hollywood that it should never link this anim because it is so big.

Show TOC