Understanding the Matrix4 class

In the foundation of geometrical transformations, there is mathematics. In Flutter, transformations are represented in a 4D matrix. Besides methods such as matrix addition or multiplication, the Matrix4 class contains methods that help with the construction and manipulation of geometric transformations. Some of them are as follows:

  • rotationrotateX(), rotateY(), and rotateZ() are some examples of methods that rotate the matrix through a specific axis.
  • scalescale(), with some variants, is used to apply a scale on the matrix using double values of the corresponding axes (xy, and z) or through vector representations with the Vector3 and Vector4 classes.
  • translation: Just like before, we can translate the matrix using the translate() method with specific xy, or z values and Vector3 and Vector4 instances.
  • skew: This is used to skew the matrix around the X axis with skewX() or Y axis with skewY().
Check the Matrix4 official documentation to all of the available possibilities this class offers: https://api.flutter.dev/flutter/vector_math/Matrix4-class.html. Remember, it is the basis of the transformations applied with the Transform widget.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.138.118.250