Difference between revisions of "StartAnimation"

From The Official Visionaire Studio: Adventure Game Engine Wiki
Line 1: Line 1:
<div class="toccolours mw-collapsible mw-collapsed tbl-ds">
+
==startAnimation==
<span class="bold">Command History</span>
 
<div class="mw-collapsible-content">
 
<div class="alt-bg">Available since v3.7</div>
 
</div></div>
 
  
 +
<div class="command-min-version-info">Available since: <span class="command-min-version">v3.0</span></div>
  
Allows you to play any animation; if the animation is already playing then the existing animation is returned!
+
<div class="command-doc">Starts an animation. If the animation is already running the existing animation is returned.</div>
  
 
+
Lua Syntax:
Syntax:
+
<pre class="command-syntax">startAnimation(animation [, reverse])</pre>
<syntaxhighlight>
+
===Arguments===
startAnimation(animation, reverse=true/false)
+
====animation====
</syntaxhighlight>
+
:'''"object path"|"object id"|object''' - Visionaire object which specifies an animation.
 
+
====reverse====
 
+
:'''true|false''' - If true the animation is played in reverse order. Default value is false.
Example 1: basic start animation method (default direction)
+
===Flags===
<syntaxhighlight>
+
===Return Values===
--[[
+
;visionaireObject
!important: you must take care when using this method that there is only instance of the animation you are calling.  
+
:The visionaire object representing the active animation.
--]]
+
===Examples===
 
+
Example 1:  
-- shortened get animation method; !important: see comment above!
 
startAnimation("Animations[animation_name]")
 
 
 
 
 
-- full get animation method; !recommended
 
startAnimation("Scenes[scene_name].SceneObjects[object_name].ObjectAnimations[animation_name]")
 
</syntaxhighlight>
 
 
 
Example 2: basic start animation method (reverse direction)
 
 
<syntaxhighlight>
 
<syntaxhighlight>
-- shortened get animation example; !important: see comment in "example 1"!
+
startAnimation("Scenes[scene_name].SceneObjects[object_name].ObjectAnimations[animation_name]"))
startAnimation("Animations[animation_name", true)
 
 
</syntaxhighlight>
 
</syntaxhighlight>
 
+
Example 2:  
Example 3: start animation via a variable
 
 
<syntaxhighlight>
 
<syntaxhighlight>
-- you can of course use variables with animations stored in them instead!
 
 
local anim = getObject("Animations[animation_name]")
 
local anim = getObject("Animations[animation_name]")
startAnimation(anim) -- default direction!
+
startAnimation(anim)
startAnimation(anim, true) -- reversed direction!
 
 
</syntaxhighlight>
 
</syntaxhighlight>
 
 
 
<span class="bold underline">Arguments</span>
 
 
<span class="bold">animation</span>: path <br/>
 
The path to the animation to be started! ("path"."object"."animation")
 
 
 
<span class="bold underline">Flags</span>
 
 
<span class="bold">reverse</span>: boolean (true/false) <br/>
 
True will play the animation in reverse, whereas false will play the animation forwards! (false is default)
 
 
 
<span class="bold underline">Return</span>
 
 
<span class="bold">visionaireObject</span> <br/>
 
The visionaire object representing the active animation!
 
{{i18n|StartAnimation}} <br/>
 
{| class="tbl-ds"
 
|-
 
|<span clasS="bold">Relevant Pages</span>: [[StopAnimation|stopAnimation]]
 
|}
 

Revision as of 18:12, 22 November 2013

startAnimation

Available since: v3.0
Starts an animation. If the animation is already running the existing animation is returned.

Lua Syntax:

startAnimation(animation [, reverse])

Arguments

animation

"object path"|"object id"|object - Visionaire object which specifies an animation.

reverse

true|false - If true the animation is played in reverse order. Default value is false.

Flags

Return Values

visionaireObject
The visionaire object representing the active animation.

Examples

Example 1:

startAnimation("Scenes[scene_name].SceneObjects[object_name].ObjectAnimations[animation_name]"))

Example 2:

local anim = getObject("Animations[animation_name]")
startAnimation(anim)