transformEffect(_:)
Applies an affine transformation to this view’s rendered output.
Declaration
nonisolated func transformEffect(_ transform: CGAffineTransform) -> some View
Parameters
- transform:
A Cgaffinetransform to apply to the view.
Discussion
Use transformEffect(_:) to rotate, scale, translate, or skew the output of the view according to the provided CGAffineTransform.
In the example below, the text is rotated at -30˚ on the y axis.
let transform = CGAffineTransform(rotationAngle: -30 * (.pi / 180))
Text("Projection effect using transforms")
.transformEffect(transform)
.border(Color.gray)[Image]
See Also
Scaling, rotating, or transforming a view
scaledToFill()scaledToFit()scaleEffect(_:anchor:)scaleEffect(_:anchor:)scaleEffect(x:y:anchor:)scaleEffect(x:y:z:anchor:)aspectRatio(_:contentMode:)rotationEffect(_:anchor:)rotation3DEffect(_:axis:anchor:anchorZ:perspective:)perspectiveRotationEffect(_:axis:anchor:anchorZ:perspective:)rotation3DEffect(_:anchor:)rotation3DEffect(_:axis:anchor:)transform3DEffect(_:)projectionEffect(_:)ProjectionTransform