SetAnimationFrameRate

From ZDoom Wiki
Jump to navigation Jump to search

Actor

void SetAnimationFrameRate(double framerate)

Usage

If the calling actor has a 3D model attached, is using decoupled animations and has an active animation set with SetAnimation, calling this function will change the running animation's framerate.

Parameters

  • double framerate
The new framerate value. Measured in frames per second, can be fractional.

Examples

class PulsingThing : Actor
{
  Default
  {
    +DECOUPLEDANIMATIONS
  }
  States
  {
  Spawn:
    // This actor will start the model's 'idlepulse' animation sequence
    // as soon as it spawns and play it in a loop. Afterwards the
    // framerate of the animation will be increased relative to how
    // little health the actor has left, between 20 and 80 FPS:
    M000 A 1 NoDelay 
    {
      SetAnimation('idlepulse', flags:SAF_LOOP|SAF_NOOVERRIDE);
      SetAnimationFramerate(clamp(100 - health, 20, 80));
    }
    loop;
  }
}

See also