StartAnimator upgrade
Posted: Sun Apr 12, 2015 9:04 am
By now it's obvious I really like to use simple components like RenderBeams and Animators 
So... I'd find it useful if the "StartAnimator" would evolve into something like an "AnimatorController" with options for Start / Stop / Pause / Reset. For example if I wanted to have an Animator work only under certain circumstances, I'd wrap it in a Condition, like this (maybe there's a better way to go about it?):
(press space to toggle the animation on/off)
but this looks a bit "noisy" to me - the whole Condition component could be cut out from the Project Tree if instead of a ZExpression I could just set a "Pause" on or off under KeyPress / OnPressed.
Admittedly it works even as is, but it'd be clearer to work with if StartAnimator had these options.

So... I'd find it useful if the "StartAnimator" would evolve into something like an "AnimatorController" with options for Start / Stop / Pause / Reset. For example if I wanted to have an Animator work only under certain circumstances, I'd wrap it in a Condition, like this (maybe there's a better way to go about it?):
Code: Select all
<?xml version="1.0" encoding="iso-8859-1" ?>
<ZApplication Name="App" Caption="ZGameEditor application" ClearColor="0.7509 0.9651 0.6902 0" FrameRateStyle="2" FixedFrameRate="30" NoSound="1">
<OnLoaded>
<ZExpression Expression="TransformerOperator.AutoStart = 0;"/>
</OnLoaded>
<OnUpdate>
<KeyPress Keys=" " RepeatDelay="0.1">
<OnPressed>
<ZExpression>
<Expression>
<![CDATA[//Original:
//TransformerOperator.AutoStart = abs(TransformerOperator.AutoStart-1);
TransformerOperator.AutoStart = TransformerOperator.AutoStart ? 0 : 1;
//This is just to visually confirm
//something's happening
App.ClearColor.G = 0.5+rnd()/2f;
App.ClearColor.B = 0.5+rnd()/2f;]]>
</Expression>
</ZExpression>
</OnPressed>
</KeyPress>
<Condition Expression="return TransformerOperator.AutoStart;">
<OnTrue>
<AnimatorSimple Name="TransformerOperator" Duration="0.25" Target="App.ClearColor.R" AutoReverse="255" RepeatCount="-1" ToValue="1"/>
</OnTrue>
</Condition>
</OnUpdate>
</ZApplication>
but this looks a bit "noisy" to me - the whole Condition component could be cut out from the Project Tree if instead of a ZExpression I could just set a "Pause" on or off under KeyPress / OnPressed.
Admittedly it works even as is, but it'd be clearer to work with if StartAnimator had these options.