An animation control displays an AVI clip. An AVI clip is a series of bitmap frames like a movie. Animation controls can only display AVI clips that do not contain audio.
Why use an animation control?
The control plays the frames of an animation automatically. You can use Liberty BASIC sprite animation for games and similar applications, but sprites require your program to handle all of the action. If you need a small animation, the animation control handles the action and makes the code shorter and the programming easier! Animation controls often appear in a dialog during file copying or downloading or searching. An animation looks like this:
Creating an Animation Control
Use CreateWindowExA to create an animation control. You will need to use GetWindowLongA to get the instance handle of your program window. The classname for an animation control is "SysAnimate32". You must include the style bits for the type of animation control desired. The styles are listed below. If you want multiple styles, put the bits together with OR like this:
style = _WS_CHILD or _WS_VISIBLE or ACS.AUTOPLAY or ACS.TRANSPARENT
In addition to the animation control styles, you must specify that the control is a child window, and that it is visible.
Animation Control Styles
Liberty BASIC does not recogize these windows constants for animation control styles, so you must set the values yourself. Instead of _ACM_OPEN use: ACM.OPEN = 1124
ACM.OPEN = 1124
ACS.AUTOPLAY = 4. Starts playing the animation as soon as the AVI clip is opened.
ACS.CENTER = 1. Centers the animation in the animation control's window.
ACS.TIMER = 8. By default, the control creates a thread to play the AVI clip. If you set this flag, the control plays the clip without creating a thread; internally the control uses a Win32 timer to synchronize playback.
ACS.TRANSPARENT = 2. Allows you to match an animation's background color to that of the underlying window, creating a "transparent" background.
Animation Control Messages
These messages are sent with SendMessageA. If an animation control has the ACS_AUTOPLAY style, it begins playing as soon as it is opened, so there is no need to send an ACM_PLAY. message. If it does not have the autoplay style, it must be sent a message to open it, and another one to play it.
ACM.OPEN = 1124. Opens an AVI clip and displays its first frame in an animation control.
ACM.PLAY = 1125. Plays an AVI clip in an animation control. The control plays the clip in the background while the thread continues executing.
ACM.STOP = 1126. Stops playing an AVI clip in an animation control.
Demo
An animated torch AVI is included here. You may download it to your computer by right-clicking and selecting "Save As."
'Alyce Watson'put your filename here:
anifile$ ="torchani.avi"'avi file name'constants
class$ ="SysAnimate32"'class for control
ACS.TRANSPARENT =2'transparent background - style
ACS.AUTOPLAY =4'play as soon as opened - style
ACM.OPEN=1124'open file - message'initialize common controls:calldll#comctl32,"InitCommonControls",_
re asvoid[WindowSetup]NoMainWinWindowWidth=300:WindowHeight=100UpperLeftX=Int((DisplayWidth-WindowWidth)/2)UpperLeftY=Int((DisplayHeight-WindowHeight)/2)[ControlSetup]button#main.default,"Exit",[quit],UL,220,10,70,24statictext#main.tip,"Isn't this cool?",80,20,100,130open"Animation Control"forwindowas#main
print#main,"trapclose [quit]"
hwndParent =hwnd(#main)' Get window instance handleCallDLL#user32,"GetWindowLongA",_
hwndParent Asulong,_GWL_HINSTANCE Aslong,_
hInstance Asulong'instance handle' Create animation control, use autoplay flag, transparent background' Must be a child window, and must be visible
style = _WS_CHILD or _WS_VISIBLE or ACS.AUTOPLAY or ACS.TRANSPARENT
calldll#user32,"CreateWindowExA",_
0Aslong,_ ' extended style
class$ asptr,_ ' class name""asptr,_ ' caption = none
style aslong,_ ' style10aslong,_ ' left x10aslong,_ ' top y0aslong,_ ' width = 00aslong,_ ' height = 0
hwndParent asulong,_ ' parent hWnd0asulong,_ ' handle to menu = 0
hInstance asulong,_ ' hInstance""asptr,_ ' pointer to window creation data = none
hwndAC asulong' animation control handle'send message to open file, which will play automaticallycalldll#user32,"SendMessageA",_
hwndAC asulong,ACM.OPENaslong,_
0aslong,anifile$ asptr,_
re aslongwait[quit]close#main :end
Animation Control
-http://alycesrestaurant.com/
Animation Control | What is an animation control? | Why use an animation control? | Creating an Animation Control | Animation Control Styles | Animation Control Messages | Demo
What is an animation control?
An animation control displays an AVI clip. An AVI clip is a series of bitmap frames like a movie. Animation controls can only display AVI clips that do not contain audio.Why use an animation control?
The control plays the frames of an animation automatically. You can use Liberty BASIC sprite animation for games and similar applications, but sprites require your program to handle all of the action. If you need a small animation, the animation control handles the action and makes the code shorter and the programming easier! Animation controls often appear in a dialog during file copying or downloading or searching. An animation looks like this:Creating an Animation Control
Use CreateWindowExA to create an animation control. You will need to use GetWindowLongA to get the instance handle of your program window. The classname for an animation control is "SysAnimate32". You must include the style bits for the type of animation control desired. The styles are listed below. If you want multiple styles, put the bits together with OR like this:In addition to the animation control styles, you must specify that the control is a child window, and that it is visible.
Animation Control Styles
Liberty BASIC does not recogize these windows constants for animation control styles, so you must set the values yourself. Instead of _ACM_OPEN use: ACM.OPEN = 1124Animation Control Messages
These messages are sent with SendMessageA. If an animation control has the ACS_AUTOPLAY style, it begins playing as soon as it is opened, so there is no need to send an ACM_PLAY. message. If it does not have the autoplay style, it must be sent a message to open it, and another one to play it.Demo
An animated torch AVI is included here. You may download it to your computer by right-clicking and selecting "Save As."Animation Control | What is an animation control? | Why use an animation control? | Creating an Animation Control | Animation Control Styles | Animation Control Messages | Demo