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

◆ exponential()

TimeMap MayaFlux::Kinesis::TimeMaps::exponential ( double  from,
double  to,
double  duration 
)
inline

Geometric path from one value to another, then constant.

Parameters
fromValue at time zero, must be positive
toValue reached at duration and kept after, must be positive
durationSeconds to travel, zero or less gives to at every time

Each equal step of time multiplies the value by the same factor, so it suits lengths and rates that should shrink or grow by a constant ratio. A non-positive from or to gives to at every time.

Definition at line 45 of file TimeMap.hpp.

46{
47 return { .fn = [from, to, duration](const double& t) -> double {
48 if (duration <= 0.0 || from <= 0.0 || to <= 0.0) {
49 return to;
50 }
51 return from * std::pow(to / from, std::clamp(t / duration, 0.0, 1.0));
52 } };
53}

References MayaFlux::Kinesis::Tendency< D, R >::fn.