gooOutline function

  1. @visibleForTesting
Path gooOutline(
  1. List<Rect> pills,
  2. List<double> blends
)

The outline of pills, as gooGeometry in shaders/liquid_glass.frag blends their distances.

Implementation

@visibleForTesting
Path gooOutline(List<Rect> pills, List<double> blends) {
  var outline = Path();
  for (final pill in pills) {
    outline.addRSuperellipse(
      RSuperellipse.fromRectAndRadius(
        pill,
        Radius.circular(pill.shortestSide / 2),
      ),
    );
  }
  for (var index = 1; index < pills.length; index++) {
    final neck = _neck(pills[index - 1], pills[index], blends[index - 1]);
    if (neck != null) {
      outline = Path.combine(PathOperation.union, outline, neck);
    }
  }
  return outline;
}