wavelength 1.0.0
Loading...
Searching...
No Matches
rampanimator.h
Go to the documentation of this file.
1#pragma once
2
3#include <memory>
4
5#include "math/interpolator.h"
6#include "rnd/rndanimatable.h"
7
15public:
27 RampAnimator(float fValue, RndAnimatable *pAnim, Interpolator *pInterp, float fSpeed);
28
36
44 void SetAnim(RndAnimatable *pAnim);
45
53 void SetSpeed(float fSpeed);
54
62 void SetTarget(float fTarget);
63
72 void Jump(float fValue, float fTarget);
73
83 bool Update(float fDelta, bool bForce);
84
86 float GetValue() const {
87 return mValue;
88 }
89
92 return mInterp.get();
93 }
94
97 return mAnim;
98 }
99
100private:
101 float mValue;
102 float mElapsed;
103 float mTimePerUnit;
104 std::unique_ptr<Interpolator> mInterp;
105 RndAnimatable *mAnim;
106};
Map from an input range to an output range, clamped at both ends.
Definition interpolator.h:11
void SetSpeed(float fSpeed)
Set the speed of a move.
void SetTarget(float fTarget)
Start moving from the current value toward a target.
void SetAnim(RndAnimatable *pAnim)
Pose an animation on the value.
RndAnimatable * GetAnim() const
Definition rampanimator.h:96
Interpolator * GetInterp() const
Definition rampanimator.h:91
bool Update(float fDelta, bool bForce)
Advance the move and pose the animation on the new value.
~RampAnimator()
Destroy the animator and its curve.
float GetValue() const
Definition rampanimator.h:86
void Jump(float fValue, float fTarget)
Move to a value at once and start moving from it toward a target.
RampAnimator(float fValue, RndAnimatable *pAnim, Interpolator *pInterp, float fSpeed)
Construct an animator resting at a value.
Mix-in for an object driven by a frame.
Definition rndanimatable.h:16