rotate method

Matrix4Transform rotate(
  1. double? angleRadians, {
  2. Offset? origin,
})

Rotates by angleRadians radians, clockwise. If you define an origin it will have that point as the axis of rotation.

Implementation

Matrix4Transform rotate(double? angleRadians, { Offset? origin}) {
  if ((angleRadians == null) || (angleRadians == 0.0))
    return this;
  else if ((origin == null) || (origin.dx == 0.0 && origin.dy == 0.0))
    return Matrix4Transform._(m.clone()..rotateZ(angleRadians));
  else
    return Matrix4Transform._(m.clone()
      ..translate(origin.dx, origin.dy)
      ..multiply(Matrix4.rotationZ(angleRadians))
      ..translate(-origin.dx, -origin.dy));
}