morphDragRecede function

double morphDragRecede(
  1. double distance, {
  2. double dimension = 400,
})

How far the container has "receded into the hand" during a free drag: a smooth asymptotic fraction (0 at rest, approaching 1) of the displacement distance. Drives the subtle scale-down and the scrim dimming while dragging - both stay pure functions of the displacement, so interruption continuity holds by construction.

Implementation

double morphDragRecede(double distance, {double dimension = 400}) {
  if (distance <= 0) {
    return 0;
  }
  return distance / (distance + dimension);
}