Difference between revisions of "StartAnimation"

From The Official Visionaire Studio: Adventure Game Engine Wiki
Line 11: Line 11:
 
Syntax:
 
Syntax:
 
<syntaxhighlight>
 
<syntaxhighlight>
startAnimation(animation [, reverse])
+
startAnimation(animation, reverse=true/false)
 
</syntaxhighlight>
 
</syntaxhighlight>
  
  
Example 1: basic start action method
+
Example 1: basic start animation method (default direction)
 
<syntaxhighlight enclose="div">
 
<syntaxhighlight enclose="div">
-- n/a: will add later!
+
--[[
 +
!important: you must take care when using this method that you don't have multiple instances of animations with the same name otherwise it will not work correctly!
 +
--]]
 +
 
 +
-- 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>
 
</syntaxhighlight>
  
 +
Example 2: basic start animation method (reverse/inverse direction)
 +
<syntaxhighlight>
 +
-- shortened get animation example; !important: see comment in "example 1"!
 +
startAnimation("Animations[animation_name", true)
 +
</syntaxhighlight>
  
 +
Example 3: start animation via a variable
 +
<syntaxhighlight>
 +
-- you can of course use variables with animations stored in them instead!
 +
local anim = getObject("Animations[animation_name]")
 +
startAnimation(anim) -- default direction!
 +
startAnimation(anim, true) -- reversed/inverted direction!
 +
</syntaxhighlight>
  
 
<b><u>Arguments</u></b>
 
<b><u>Arguments</u></b>
  
 
animation: link <br/>
 
animation: link <br/>
The link to the animation to be started! ("path"|"object_id"|"animation_name")
+
The link to the animation to be started! ("path"."object"."animation")
  
 
Flags: none
 
Flags: none

Revision as of 00:05, 7 March 2013

Command History

Available since v3.7


Allows you to play any animation; if the animation is already playing then the existing animation is returned!


Syntax:

startAnimation(animation, reverse=true/false)


Example 1: basic start animation method (default direction)

--[[
!important: you must take care when using this method that you don't have multiple instances of animations with the same name otherwise it will not work correctly!
--]]

-- 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]")

Example 2: basic start animation method (reverse/inverse direction)

-- shortened get animation example; !important: see comment in "example 1"!
startAnimation("Animations[animation_name", true)

Example 3: start animation via a variable

-- you can of course use variables with animations stored in them instead!
local anim = getObject("Animations[animation_name]")
startAnimation(anim) -- default direction!
startAnimation(anim, true) -- reversed/inverted direction!

Arguments

animation: link
The link to the animation to be started! ("path"."object"."animation")

Flags: none

Return: visionaireObject
The visionaire object representing the active animation!