lerp method
Linear interpolation between two tokens
Implementation
FlyTrackingToken lerp(FlyTrackingToken other, double t) {
final result = <String, double>{};
final allKeys = {..._allValues.keys, ...other._allValues.keys};
for (final key in allKeys) {
final valueA = _allValues[key];
final valueB = other._allValues[key];
final numA = valueA ?? 0.0;
final numB = valueB ?? 0.0;
result[key] = numA + (numB - numA) * t;
}
return FlyTrackingToken(
tighter: result['tighter']!,
tight: result['tight']!,
normal: result['normal']!,
wide: result['wide']!,
wider: result['wider']!,
widest: result['widest']!,
extras: Map.fromEntries(
result.entries.where(
(e) => ![
'tighter',
'tight',
'normal',
'wide',
'wider',
'widest',
].contains(e.key),
),
),
);
}