globalTransformationMatrix property
Matrix
globalTransformationMatrix
The global 2D transformation matrix of this display object.
Note: You can get the global transformation matrix either with the globalTransformationMatrix or the globalTransformationMatrix3D getter. You only need to use a 3D transformation matrix if you are working with 3D display objects.
Implementation
Matrix get globalTransformationMatrix {
final result = Matrix.fromIdentity();
for (DisplayObject? obj = this; obj != null; obj = obj.parent) {
if (obj is DisplayObjectContainer3D) {
throw StateError("Can't calculate 2D matrix for 3D display object.");
} else {
result.concat(obj.transformationMatrix);
}
}
return result;
}