Anim8
Info
Dependencies:
- Floats
Implementation:
 Anim8.d on GitHub
This package allows int or float values to be "animated" over a period of time. It is possible to string several commands together and to set the type of movement. The new version of PrintS from Interface uses Anim8.
Initialization
Initialize with LeGo_Anim8 flag.
Functions
Anim8_New
Anim8_New
Creates a new Anim8 object that can be filled with commands.
- var int initialValue
 The initial value to start animating from. Can be an integer, or an Ikarus float.
- var int IsFloat
 If the- initialValueis an Ikarus float, this parameter must be set to- TRUE. If it is an integer, it must be set to- FALSE.
Return value
The function returns handle of the Anim8 object.
Anim8_NewExt
Anim8_NewExt
Creates a new Anim8 object with advanced options. Extends the Anim8_New function.
- var int value
 The initial value to start animating from. Can be an integer, or an Ikarus float.
- var func handler
 This function is called whenever the object is updated. The signature of the functions depends on the- datavalue:
 - data != 0:- func void handler(var int data, var int value),
 - data == 0:- func void handler(var int value).
- var int data
 Optional parameter to send an additional value to the- handlerfunction. If- data == 0, it is ignored.
- var int IsFloat
 If the- initialValueis an Ikarus float, this parameter must be set to- TRUE. If it is an integer, it must be set to- FALSE.
Return value
The function returns handle of the Anim8 object.
Anim8_Delete
Anim8_Delete
Deletes an Anim8 object created with Anim8_New.
- var int handle
 Handle returned from- Anim8_New
Anim8_Get
Anim8_Get
Get current value of the object.
- var int handle
 Handle returned from- Anim8_New
Return value
The function returns value of the object.
Anim8_Set
Anim8_Set
Sets the value of the object.
- var int handle
 Handle returned from- Anim8_New
- var int value
 New value of the object
Anim8_Empty
Anim8_Empty
Indicates whether the object is empty, i.e. has no more commands to process.
- var int handle
 Handle returned from- Anim8_New
Return value
The function returns TRUE if object is empty (has no more commands), FALSE is returned otherwise.
Anim8_RemoveIfEmpty
Anim8_RemoveIfEmpty
If desired, Anim8 can automatically delete an object after it is empty.
- var int handle
 Handle returned from- Anim8_New
- var int on
 - TRUE: enable,- FALSE: disable
Anim8_RemoveDataIfEmpty
Anim8_RemoveDataIfEmpty
With Anim8_NewExt handler and data can be set. If this function is called with TRUE, data is taken as a handle and delete(data) is called if the object is empty. Works only if Anim8_RemoveIfEmpty is also activated.
- var int handle
 Handle returned from- Anim8_New
- var int on
 - TRUE: enable,- FALSE: disable
Anim8
Anim8
Packet core. Gives the object a new command to process.
- var int handle
 Handle returned from- Anim8_New
- var int target
 Target value of this command. When the object's value has reached this value, the command is considered completed and deleted.
- var int span
 Action duration in milliseconds
- var int interpol
 What form of movement is used (See constants for this)
Anim8q
Anim8q
As already mentioned above, Anim8 can also process several commands one after the other. While Anim8 completely resets the object and deletes all commands, Anim8q just appends a new command to the list. This will be processed as soon as the previous one is completed.
- var int handle
 Handle returned from- Anim8_New
- var int target
 Target value of this command. When the object's value has reached this value, the command is considered completed and another one in the queue will start.
- var int span
 Action duration in milliseconds
- var int interpol
 What form of movement is used (See constants for this)
Anim8_CallOnRemove
Anim8_CallOnRemove
Registers a function to be called when the object is deleted (e.g. by Anim8_RemoveIfEmpty)
- var int handle
 Handle returned from- Anim8_New
- var func dfnc
 This function is called when the object is deleted
Examples
Count up to a number
Count from 0 to 10 in 10 seconds. We use the Print_Ext function from Interface to display the text.
Moving zCVob in loop
Now we make a vob constantly move back and forth, but without a mover. FrameFunctions are used for the loop: