scaleX property

double get scaleX

Derived X scale magnitude (convenience accessor).

This value is always non-negative and represents the length of the first basis column of the 2×2 linear part. For flipped transforms (det < 0), the reflection sign is represented via scaleY (canonical TRS(+flip) decomposition).

Implementation

double get scaleX {
  final t = transform;
  assert(
    t.a.isFinite && t.b.isFinite && t.c.isFinite && t.d.isFinite,
    'SceneNode.scaleX requires finite transform.',
  );

  final a = t.a;
  final b = t.b;
  final sx = math.sqrt(a * a + b * b);
  if (!sx.isFinite) return 0;
  if (nearZero(sx)) return 0;
  return sx;
}
set scaleX (double value)

Implementation

set scaleX(double value) {
  _requireTrsTransformForConvenienceSetter(transform, 'scaleX');
  transform = Transform2D.trs(
    translation: position,
    rotationDeg: rotationDeg,
    scaleX: value,
    scaleY: scaleY,
  );
}