StartAnimator upgrade

If there is something important you think is missing in the current version of ZGameEditor then you can post a feature request here!

Moderator: Moderators

Post Reply
User avatar
rrTea
Posts: 475
Joined: Sat Feb 15, 2014 9:54 am

StartAnimator upgrade

Post by rrTea »

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?):

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>
(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.
Imerion
Posts: 200
Joined: Sun Feb 09, 2014 4:42 pm

Post by Imerion »

Sounds smart! As I often use these myself too, a simple way to do :

MySimpleAnimator.Pause = 0;
MySimpleAnimator.Pause = 1;

To start and stop playback of animation would be nice!
Post Reply