pathFor method

Path pathFor(
  1. double t,
  2. Size size,
  3. Path path
)

Resets path to the outline at press t (0 rest, 1 pressed), scaled into size (the polygon's unit-square box maps onto the cell, so the shape fills it exactly).

Implementation

Path pathFor(double t, Size size, Path path) {
  flat.toPath(t, path);
  final scale = math.max(size.width, size.height);
  final dx = (size.width - scale) / 2;
  final dy = (size.height - scale) / 2;
  final matrix = Float64List(16)
    ..[0] = scale
    ..[5] = scale
    ..[10] = 1
    ..[12] = dx
    ..[13] = dy
    ..[15] = 1;
  return path.transform(matrix);
}