POV-Ray : Newsgroups : povray.advanced-users : Tracking animation 'state' : Re: Tracking animation 'state' Server Time
28 Jul 2024 18:27:27 EDT (-0400)
  Re: Tracking animation 'state'  
From:
Date: 17 Jun 2004 22:35:01
Message: <40d254d5$1@news.povray.org>
// Hi Ross,
      //
      // you could write a macro like this:

#macro CalculateFrameParameters (TheClock)
  #declare Flap = sin(radians(TheClock*360*FlapsInAnimation));
  #declare Spread = /* whatever*/;
  /* ... */
  #end//macro

      // Then do this at the beginning of each frame:

#declare ShortTime = 0.01; // or clock_delta
CalculateFrameParameters (clock-ShortTime)
#declare OldFlap = Flap;
#declare OldSpread = Spread;
CalculateFrameParameters (clock)

      // Now a comparison of OldFlap and Flap
      // tells direction and intensity of
      // the motion. For example:

#declare WingSpeed = (Flap-OldFlap)/ShortTime;
#if (WingSpeed>0)
    /* wing goes up */
  #else
    /* wing goes down */
  #end


      // If your formulas don't like TheClock<0
      // then add the following statement between
      // "#macro ..." and "#declare Flap ...":

  #if (TheClock<0) #declare TheClock = 0; #end



      //    Sputnik


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.