computeCloseBlobAEmergence static method

double computeCloseBlobAEmergence({
  1. required Rect platterRect,
  2. required double platterRadius,
  3. required Offset triggerCenter,
  4. required double rawValue,
})

Computes the gap-gated scale factor (0.0, or 0.45 → 1.0) for the trigger's ghost blob (Blob A) during close so it stays hidden while the droplet pulls away and emerges inside the smooth-union bridge reach with zero detached-dot frames.

Implementation

static double computeCloseBlobAEmergence({
  required Rect platterRect,
  required double platterRadius,
  required Offset triggerCenter,
  required double rawValue,
}) {
  final u = rawValue.clamp(0.0, 1.0);
  final r = math.min(
    platterRadius,
    math.min(platterRect.width, platterRect.height) * 0.5,
  );
  final inner = platterRect.deflate(r);
  final ddx = math.max(
    math.max(inner.left - triggerCenter.dx, triggerCenter.dx - inner.right),
    0.0,
  );
  final ddy = math.max(
    math.max(inner.top - triggerCenter.dy, triggerCenter.dy - inner.bottom),
    0.0,
  );
  final gap = math.max(0.0, math.sqrt(ddx * ddx + ddy * ddy) - r);
  final byTime = _smoothstep01((0.40 - u) / 0.12);
  final byGap = _smoothstep01((24.0 - gap) / 11.0);
  final emerge = math.min(byTime, byGap);
  return emerge <= 0.001 ? 0.0 : (0.45 + 0.55 * emerge);
}