Name
PlayAnim -- play an animation
Synopsis
[handle] = PlayAnim(id[, x, y, table])
Function
This function starts playing a preloaded animation specified by id. Optionally you can specify the x and y coordinates on the screen where the animation should be displayed.

If layers are enabled, this command will add a new layer of the type #ANIM to the layer stack.

As of Hollywood 4.0, PlayAnim() accepts an additional optional table argument which can be used to configure several further playback options:

Speed:
Defines the playback speed for the animation. The higher the number, the slower the playback speed. You can also specify a constant for the speed argument (#SLOWSPEED, #NORMALSPEED or #FASTSPEED). New in Hollywood 4.5: You can specify the new #DEFAULTSPEED constant here. If you use #DEFAULTSPEED, Hollywood will use the speed as defined in the animation file. Note that not all animations define such a speed but if they do, it should be respected because otherwise the playback looks wrong.

Times:
Specifies how many times the animation shall be played (defaults to 1 which means play anim just once). If you want the animation to loop infinitely, specify 0 here.

Async:
You can use this field to create an asynchronous draw object for this playback. If you pass True here PlayAnim() will exit immediately, returning a handle to an asynchronous draw object which you can then draw using AsyncDrawFrame(). See AsyncDrawFrame for more information on asynchronous draw objects.

Inputs
id
identifier of the animation to play
x
optional: x playback position (defaults to 0)
y
optional: y playback position (defaults to 0)
table
optional: further configuration for the anim playback
Results
handle
optional: handle to an asynchronous draw object; will only be returned if Async has been set to True (see above)
Example
PlayAnim(1)
Play the animation 1.

Show TOC