DecomposedTransform

ceramic.DecomposedTransform (Class)

Decomposed transform holds rotation, translation, scale, skew and pivot informations. Provided by Transform.decompose() method. Angles are in radians.

This class represents a 2D transformation broken down into its individual components, making it easier to understand and manipulate complex transformations. It's particularly useful for animation, debugging, and converting between different transformation representations.

Components

  • Translation: x, y position
  • Rotation: Angle in radians
  • Scale: Horizontal and vertical scaling factors
  • Skew: Horizontal and vertical shearing
  • Pivot: Center point for transformations

Usage Example

// Decompose a transform matrix
var transform = new Transform();
transform.translate(100, 50);
transform.rotate(Math.PI / 4);
transform.scale(2, 1.5);

var decomposed = new DecomposedTransform();
transform.decompose(decomposed);

trace('Position: ${decomposed.x}, ${decomposed.y}');
trace('Rotation: ${decomposed.rotation} radians');
trace('Scale: ${decomposed.scaleX}, ${decomposed.scaleY}');
See: ceramic.Transform For matrix operations and decomposition, ceramic.Visual For applying transforms to visuals

Instance Members

pivotX: Float

X coordinate of the pivot point. The pivot is the center point around which rotation and scaling occur. Default: 0


pivotY: Float

Y coordinate of the pivot point. The pivot is the center point around which rotation and scaling occur. Default: 0


X position (horizontal translation). This is the final position after all transformations are applied. Default: 0


Y position (vertical translation). This is the final position after all transformations are applied. Default: 0


rotation: Float

Rotation angle in radians. Positive values rotate clockwise. Default: 0

decomposed.rotation = Math.PI / 2; // 90 degrees
decomposed.rotation = Math.PI;     // 180 degrees

scaleX: Float

Horizontal scaling factor. Values > 1 stretch horizontally, < 1 compress. Negative values flip horizontally. Default: 1


scaleY: Float

Vertical scaling factor. Values > 1 stretch vertically, < 1 compress. Negative values flip vertically. Default: 1


skewX: Float

Horizontal skew angle in radians. Shears the shape horizontally. Default: 0


skewY: Float

Vertical skew angle in radians. Shears the shape vertically. Default: 0


new(): Void

Creates a new decomposed transform with default values. All values are initialized to identity transform.

Private Members

toString(): String

Returns a string representation of the decomposed transform. Useful for debugging and logging transformation values.

Returns Description
String String in format: "(pos=x,y pivot=px,py rotation=r scale=sx,sy skew=skx,sky)"