stopAnimation()
This function stops an animation.
Synopsis
int stopAnimation(int id);
Parameters
-
Parameters Description id The ID (> 0) the function createAnimation() returns when creating a parallel or sequential group
Use this ID when calling the function animate() as first argument to fill the group with separate animations and the to start the specific animation. In the example further below:
g = createAnimation(); .
startAnimation(g, "keep", makeMapping("direction", "Forward"));
stopAnimation(g);
Return value
The function returns 0 when it was executed successfully and -1 in case of errors.
Description
The function stops an animation group that was created by using the function createAnimation() and started by using the function startAnimation() - see example below.
Note that animations need a lot of CPU. When animations run for a longer period of time, this might be noticeable!
Example
The following example opens a panel via the function RootPanelOnModule() and moves and scales the panel up when it is opened. The example also shows you how to stop an animation group via the function stopAnimation(). Note that in order to use this script, you need panels called "empty.pnl" and ""flyIn.pnl". Add the script to the "clicked" event of a button.
int g;
bool isShown = false;
main()
{
if ( isShown )
{
/* Stops the animation with the ID "g" */
stopAnimation(g);
RootPanelOnModule("empty", "empty", flyInModule.ModuleName, "");
/* Opens the panel "empty" in the module "flyInModule.ModuleName
*/
startAnimation(g, "keep", makeMapping("direction", "Backward"));
/* Moves the panel backwards
*/
this.fill = "[pattern,[fit,any,arrow_left_modern.png]]";
/* Fills the button that is clicked
*/
isShown = false;
}
else
{
if ( !g )
{
g = createAnimation();
/* Creates an animation group
*/
flyInModule.visible = true;
/* Sets the module visible
*/
animate(g, "flyInModule", "sizeAsDyn", makeDynInt(0, 0),
makeDynInt(581, 341), makeMapping("duration", 600));
animate(g, "flyInModule", "positionAsDyn", makeDynInt(809, 100),makeDynInt(34, 170), makeMapping("duration", 600));
}
/* Creates an animation by changing the size and the position of the panel "flyInModule"
*/
startAnimation(g, "keep", makeMapping("direction", "Forward"));
/* Moves the animation "g" forwards
*/
RootPanelOnModule("flyIn", "flyIn", flyInModule.ModuleName, "");
this.fill = "[pattern,[fit,any,arrow_right_modern.png]]"
/* Fills a button
*/
isShown = true;
}
}
Assignment
Graphic functions
Availability
UI