interpolation property
The function used to convert the raw device pressure values into a value in the range 0.0 to 1.0.
The function takes in the device's minimum, maximum and raw touch pressure and returns a value in the range 0.0 to 1.0 denoting the interpolated touch pressure.
This function must always return values in the range 0.0 to 1.0 given a
pressure that is between the minimum and maximum pressures. It may return
double.NaN
for values that it does not want to support.
By default, the function is a linear interpolation; however, changing the function could be useful to accommodate variations in the way different devices respond to pressure, or to change how animations from pressure feedback are rendered.
For example, an ease-in curve can be used to determine the interpolated value:
double interpolateWithEasing(double min, double max, double t) {
final double lerp = (t - min) / (max - min);
return Curves.easeIn.transform(lerp);
}
Implementation
final GestureForceInterpolation interpolation;