matrix property

Matrix4 matrix
latefinal

Fallback matrix for the web.

Since Canvas.drawAtlas is not supported on the web we also build a Matrix4 based on the transform and flip values.

Implementation

late final Matrix4 matrix = Matrix4(
  transform.scos, transform.ssin, 0, 0, //
  -transform.ssin, transform.scos, 0, 0, //
  0, 0, 0, 0, //
  transform.tx, transform.ty, 0, 1, //
)
  ..translate(source.width / 2, source.height / 2)
  ..rotateY(flip ? pi : 0)
  ..translate(-source.width / 2, -source.height / 2);