rotateAngle method

Matrix4 rotateAngle(
  1. double angle, {
  2. Offset? origin,
})

Rotates teh matrix by given angle

Implementation

Matrix4 rotateAngle(double angle, {Offset? origin}) {
  final angleRadians = angle * pi / 180;

  if (angleRadians == 0.0) {
    return this;
  } else if ((origin == null) || (origin.dx == 0.0 && origin.dy == 0.0)) {
    return this..rotateZ(angleRadians);
  } else {
    return this
      ..translate(origin.dx, origin.dy)
      ..multiply(Matrix4.rotationZ(angleRadians))
      ..translate(-origin.dx, -origin.dy);
  }
}