MayaFlux 0.4.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ damp()

template<typename T >
T MayaFlux::Kinesis::damp ( current,
target,
smoothing,
dt 
)
inlinenoexcept

Exponential smoothing: move current toward target at rate smoothing over time step dt.

smoothing is a half-life in seconds: the distance to target halves every smoothing seconds. At smoothing = 0.1 the value tracks quickly; at smoothing = 2.0 it lags heavily.

Framerate-independent. Equivalent to the "lerp every frame" pattern done correctly: current = lerp(current, target, 1 - exp(-dt / smoothing))

Degenerate case (smoothing <= 0) snaps to target immediately.

Definition at line 115 of file Scalar.hpp.

116{
117 if (smoothing <= T { 0 })
118 return target;
119 return current + (target - current) * (T { 1 } - std::exp(-dt / smoothing));
120}
glm::vec2 current

References current.