openclonk/docs/sdk/script/fn/Anim_Dist.xml

62 lines
2.9 KiB
XML

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!DOCTYPE funcs
SYSTEM '../../../clonk.dtd'>
<?xml-stylesheet type="text/xsl" href="../../../clonk.xsl"?>
<funcs>
<func>
<title>Anim_Dist</title>
<category>Animations</category>
<version>6.0 OC</version>
<syntax>
<rtype>array</rtype>
<params>
<param>
<type>int</type>
<name>position</name>
<desc>Start value. Should be inside the interval given by begin and end.</desc>
</param>
<param>
<type>int</type>
<name>begin</name>
<desc>Start of the interval.</desc>
</param>
<param>
<type>int</type>
<name>end</name>
<desc>End of the interval. If end is greater than begin then the value increases with every movement of the object, otherwise it decreases.</desc>
</param>
<param>
<type>int</type>
<name>length</name>
<desc>Number of pixels to be moved for the animation to be played from begin to end.</desc>
</param>
</params>
</syntax>
<desc>The value depends on the distance travelled by the aboject. Every pixel the object moves increases the value a little bit. Once end has been reached the value is reset to begin. This is a combination of <funclink>Anim_AbsX</funclink> and <funclink>Anim_AbsY</funclink>, where the movement in both coordinates is considered.</desc>
<remark>See the <emlink href="definition/animations.html">animation documentation</emlink> for further explanations of the animation system.</remark>
<examples>
<example>
<code><funclink>PlayAnimation</funclink>(&quot;Fly&quot;, 5, <funclink>Anim_Dist</funclink>(0, 0, <funclink>GetAnimationLength</funclink>(&quot;Fly&quot;), 20), <funclink>Anim_Const</funclink>(1000));</code>
<text>Plays the animation "Fly" in slot 5, superimposing any other potential animations in slot 5. The animation is played the faster the faster the object moves. Once it moved 20 pixels the animation has been played from begin to end and restarts at its beginning. This could be used for an engine animation of a flying object where the engine should only be animated as long as the object is moving.</text>
</example>
</examples>
<related>
<funclink>PlayAnimation</funclink>
<funclink>SetAnimationPosition</funclink>
<funclink>SetAnimationWeight</funclink>
<funclink>Anim_Const</funclink>
<funclink>Anim_Linear</funclink>
<funclink>Anim_X</funclink>
<funclink>Anim_Y</funclink>
<funclink>Anim_R</funclink>
<funclink>Anim_AbsX</funclink>
<funclink>Anim_AbsY</funclink>
<funclink>Anim_Dist</funclink>
<funclink>Anim_XDir</funclink>
<funclink>Anim_YDir</funclink>
<funclink>Anim_Action</funclink>
</related>
</func>
<author>Clonk-Karl</author><date>2014-10</date>
</funcs>