kBezierSpringBuilder function

SpringDescription kBezierSpringBuilder({
  1. required IndicatorMode mode,
  2. required double offset,
  3. required double actualTriggerOffset,
  4. required double velocity,
})

Spring used by bezier curves.

Implementation

physics.SpringDescription kBezierSpringBuilder({
  required IndicatorMode mode,
  required double offset,
  required double actualTriggerOffset,
  required double velocity,
}) {
  double mass = 6 + (offset - actualTriggerOffset) / 36;
  double damping = 0.75 + velocity.abs() / 10000;
  double stiffness = 1000 + velocity.abs() / 6;
  return physics.SpringDescription(
    mass: mass,
    stiffness: stiffness,
    damping: damping,
  );
}