toShape method

Path toShape(
  1. double size,
  2. double maxSize
)

Implementation

Path toShape(double size, double maxSize) {
  final startArm = (size + (maxSize - size) * startSize) * 0.5;
  final endArm = (size + (maxSize - size) * endSize) * 0.5;

  final sDirUp = upStartVector;
  final eDirUp = upEndVector;

  final d1 = sDirUp * startArm;
  final d2 = eDirUp * endArm;
  final d3 = eDirUp.rotate(math.pi) * endArm;
  final d4 = sDirUp.rotate(math.pi) * startArm;

  return Path()
    ..start(start + d1)
    ..cubic(cpStart + d1, cpEnd + d2, end + d2)
    ..line(end + d3)
    ..cubic(cpEnd + d3, cpStart + d4, start + d4)
    ..close();
}