# Anim_Linear

Animations
5.1 OC
array
int position Start value. Should be inside the interval given by begin and end.
int begin Start of the interval.
int end End of the interval. If end is larger than begin then the value increases linearily with time, otherwise it decreases.
int length Number of frames for the animation to be played from begin to end.
int on_ending Specifies what happens once end is reached. There are the following possibilities:

Constant
Value
Description
ANIM_Loop
0
Once end is reached the value is reset to begin so the cycle restarts.
ANIM_Hold
1
Once end is reached the value remains constant.
ANIM_Remove
2
Once end is reached the corresponding animation is removed the same way as if AnimationStop were called to the exact point in time. For combination nodes the child node with the smaller weight is removed.

The value increases or decreases (depending on whether end is smaller or larger than begin) linearily in time (in frames). Initially the value is set to position and it is moving towards end. One cycle from begin to end lasts for length frames. If position and begin are not the same then end will be reached earlier already. on_ending specifies what happens once the end is reached.
See the animation documentation for further explanations of the animation system.
var start = 0; var end = GetAnimationLength("Turn"); if(GetWind() < 0) { start = end; end = 0; }

if(GetWind() != 0) SetAnimationPosition(GetRootAnimation(5), Anim_Linear(GetAnimationPosition(GetRootAnimation(5)), start, end, 7200/GetWind(), ANIM_Loop)); else SetAnimationPosition(GetRootAnimation(5), Anim_Const(GetAnimationPosition(GetRootAnimation(5))));
Sets the speed with which the animation in slot 5 is played depending on the wind speed. If the wind blows to the left then the animation is played backwards. Another possibility would be to set the position each frame using Anim_Const, however with the solution using Anim_Linear it is enough to call the function every couple of frames since the windmill continues to turn with contstant speed between calls (in other words, it is assumed that the wind speed will not change much for small time intervals).
PlayAnimation
SetAnimationPosition
SetAnimationWeight
Anim_Const
Anim_X
Anim_Y
Anim_R
Anim_AbsX
Anim_AbsY
Anim_XDir
Anim_YDir
Anim_Action
Clonk-Karl
2010-01