CGAffineTransform() constructor
The CGAffineTransform() constructor creates a transform from the six numbers of the matrix given directly.
In everyday use you do not need to fill in these six numbers directly: create basic transforms with scale(), translation(), and rotation(), then combine them with concat(). Use the constructor only when those methods cannot produce the transform you need.
Syntax
new CGAffineTransform([a[, b[, c[, d[, tx[, ty]]]]]])Parameters
a, b, c, d, tx, ty
The six numbers of the matrix, positioned as below. tx and ty are translations, in pt; the other four are ratios with no unit.
| a b 0 |
| c d 0 |
| tx ty 1 |Each argument is converted to a number. Omitted arguments are 0, so new CGAffineTransform() gives six zeros, not the identity matrix; for the identity matrix use CGAffineTransform.identity.
Return value
A new CGAffineTransform. Its fields are read-only.
Exceptions
TypeError
An argument cannot be converted to a finite number: a struct field must be a finite number, got NaN, ending with the value received.
Examples
const skew = new CGAffineTransform(1, 0, 0.5, 1, 0, 0);
console.log(String(skew));Result: logs CGAffineTransform(1, 0, 0.5, 1, 0, 0). Assigned to a view's transform, it skews the view horizontally; how it looks on screen is not verified in the simulator.
Corresponding iOS API
CGAffineTransformMake(a, b, c, d, tx, ty).
See also
CGAffineTransform.identity: the identity matrix- Structs: rules shared by all structs