rectAt method

Rect rectAt(
  1. Duration position, {
  2. double? sheetWidth,
  3. double? sheetHeight,
})

Sprite sheet дотор тухайн thumbnail-ийн байршил. sheetWidth, sheetHeight — бодит зургийн хэмжээ (pixels).

Implementation

Rect rectAt(Duration position, {double? sheetWidth, double? sheetHeight}) {
  final tw = sheetWidth  != null ? sheetWidth  / columns : (_thumbWidth  ?? 160);
  final th = sheetHeight != null ? sheetHeight / rows    : (_thumbHeight ?? 90);
  final g  = gridAt(position);
  return Rect.fromLTWH(g.col * tw, g.row * th, tw, th);
}