morphElevation static method

double morphElevation(
  1. double progress, {
  2. double baseElevation = 4.0,
  3. double peakElevation = 16.0,
})

Shadow elevation: peaks in the middle of the transition, then drops. At 0.0 → baseElevation, at 0.5 → peakElevation, at 1.0 → 0.0.

Implementation

static double morphElevation(
  double progress, {
  double baseElevation = 4.0,
  double peakElevation = 16.0,
}) {
  final t = progress.clamp(0.0, 1.0);
  if (t < 0.5) {
    final upT = t / 0.5;
    return lerpDouble(baseElevation, peakElevation, upT)!;
  } else {
    final downT = (t - 0.5) / 0.5;
    return lerpDouble(peakElevation, 0.0, downT)!;
  }
}