Name
BeginAnimStream -- begin sequential anim creation (V4.5)
Synopsis
[id] = BeginAnimStream(id, file$, width, height[, format, table])
Function
This function allows you to create an empty animation object on disk that you can then subsequently append frames to using WriteAnimFrame(). The advantage of BeginAnimStream() over SaveAnim() is that SaveAnim() requires you to provide an animation object as the source. If you use BeginAnimStream(), you can append frames to your animation from individual brush objects. This gives you the utmost flexibility. Because of its sequential design, BeginAnimStream() can be used to create new animations for virtually unlimited size and length. You could easily create a 2 hour AVI video with this function.

The first argument to BeginAnimStream() must be an id for the new write animation object. Alternatively, you can specify Nil and BeginAnimStream() will return a handle to the object to you. The second argument specifies a path to a file that shall be created for this anim. Arguments three and four specify the desired dimensions of the animation. The fifth argument specifies the format of the animation. The animation can currently be exported either as a GIF ANIM (limited to 256 colors) or as an AVI file using Motion JPEG compression. To save a GIF ANIM, use #ANMFMT_GIF as format; to save an AVI, use #ANMFMT_MJPEG.

The optional table argument allows you to configure further parameters:

Quality:
Here you can specify a value between 0 and 100 indicating the compression quality for lossy compression formats. A value of 100 means best quality, 0 means worst quality. This is only available for anim formats that support lossy compression. Defaults to 90 which means pretty good quality.

FPS:
Video formats like AVI do not support an individual delay value for each frame but require a global value indicating how many frames per second shall be displayed. This field allows you to set the FPS. This is only handled for video file formats. Defaults to 25 frames per second.

UseAlpha:
Specifies whether or not the resulting animation file should use alpha channel transparency. This is only available for anim formats that supported alpha channel transparency. Defaults to False. (V5.1)

Here is a table that shows an overview which table elements can be used with the different animation formats:

When you have successfully obtained a handle to a new animation object, you can then sequentially append frames to it using WriteAnimFrame(). When you are done adding frames, you have to call FinishAnimStream() to finalize the animation file on disk and make it ready for use.

Inputs
id
id for the animation object or Nil for auto id selection
file$
destination file
width
desired width for the animation
height
desired height for the animation
format
optional: which anim format to use (defaults to #ANMFMT_GIF)
table
optional: further arguments for save operation; see above
Results
id
optional: identifier of the animation; will only be returned when you pass Nil as argument 1 (see above)
Example
CreateBrush(1, 320, 240)
SelectBrush(1)
SetFillStyle(#FILLCOLOR)
BeginAnimStream(1, "test.gif", 320, 240)
For Local k = 1 To 100
   Circle(#CENTER, #CENTER, k * 2, #RED)
   WriteAnimFrame(1, 1)
Next
FinishAnimStream(1)
EndSelect
The code above creates a new GIF animation with 100 frames. The animation will show a red circle zooming into the screen.

Show TOC