lerp static method
Linearly interpolates a value within a given range.
Given a min
and max
range and a t
value between 0 and 1, returns a
linearly interpolated value within the min
-max
range.
Example:
final min = 0;
final max = 100;
final t = 0.5;
final interpolatedValue = Math.lerp(min, max, t);
print(interpolatedValue); // 50
Implementation
@pragma("vm:prefer-inline")
static double lerp(num min, num max, double t) {
return min + (max - min) * t;
}