expressiveRotated function

ExpressiveRoundedPolygon expressiveRotated(
  1. ExpressiveRoundedPolygon polygon,
  2. double degrees
)

polygon through Compose's Matrix().apply { rotateZ(degrees) }.

Implementation

ExpressiveRoundedPolygon expressiveRotated(
  ExpressiveRoundedPolygon polygon,
  double degrees,
) {
  final r = degrees * math.pi / 180;
  final s = math.sin(r);
  final c = math.cos(r);
  return polygon.transformed((x, y) => (c * x - s * y, s * x + c * y));
}