toMatrix4 method

Matrix4 toMatrix4({
  1. required Size screenSize,
})

Implementation

Matrix4 toMatrix4({required Size screenSize}) {
  Matrix4 _matrix4 = Matrix4.identity();
  operations.forEach((element) {
    if (element.operation == SmoothMatrix4OperationType.rotate) {
      if (element.rotationX != null) {
        _matrix4.rotateX(element.rotationX!);
      } else if (element.rotationY != null) {
        _matrix4.rotateY(element.rotationY!);
      } else if (element.rotationZ != null) {
        _matrix4.rotateZ(element.rotationZ!);
      }
    } else if (element.operation == SmoothMatrix4OperationType.scale) {
      _matrix4.scale(element.scaleX, element.scaleY);
    } else if (element.operation == SmoothMatrix4OperationType.translate) {
      _matrix4.translate(
        element.translateX?.toPX(screenSize: screenSize) ?? 0.0,
        element.translateY?.toPX(screenSize: screenSize) ?? 0.0,
      );
    }
  });
  return _matrix4;
}