Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UI layout fixes #955

Merged
merged 8 commits into from
Feb 11, 2025
10 changes: 10 additions & 0 deletions flutter/lib/resources/utils.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'dart:convert';
import 'dart:ui';

import 'package:mlperfbench/resources/resource.dart';

Expand All @@ -23,3 +24,12 @@ String jsonToStringIndented(dynamic json) {
const jsonEncoder = JsonEncoder.withIndent(' ');
return jsonEncoder.convert(json);
}

/// Lineraly interpolates between [start] and [end] using a [factor] between [valueStart] and [ValueEnd] instead of between 0 and 1.
double? lerpRange(
num? start, num? end, double valueStart, double valueEnd, double factor) {
final double valueEndNormalized = valueEnd - valueStart;
final double factorNormalized = (factor - valueStart) / valueEndNormalized;

return lerpDouble(start, end, factorNormalized);
}
Loading
Loading