Declaration
compose().projectionEffect(
transform: SwiftUI.ProjectionTransform
)nonisolated func projectionEffect(
_ transform: ProjectionTransform
) -> some ViewParameters
transform*SwiftUI.ProjectionTransformA
ProjectionTransformto apply to the view.
Discussion
Use projectionEffect(_:) to apply a 3D transformation to the view.
The example below rotates the text 30˚ around the z axis, which is the
axis pointing out of the screen:
// This transform represents a 30˚ rotation around the z axis.
let transform = CATransform3DMakeRotation(
-30 * (.pi / 180), 0.0, 0.0, 1.0)
Text("Projection effects using transforms")
.projectionEffect(.init(transform))
.border(Color.gray)See also
More in Visual effects.
- allowedDynamicRangeReturns a new view configured with the specified allowed dynamic range.
- backgroundExtensionEffectAdds the background extension effect to the view. The view will be duplicated into mirrored copies which will be placed around the view on any edge with available safe area. Additionally, a blur effect will be applied on top to blur out the copies.
- blurApplies a Gaussian blur to this view.
- brightnessBrightens this view by the specified amount.
- clippedClips this view to its bounding rectangular frame.
- colorEffectReturns a new view that applies shader to self as a filter effect on the color of each pixel.
- colorInvertInverts the colors in this view.
- colorMultiplyAdds a color multiplication effect to this view.
- compositingGroupWraps this view in a compositing group.
- contrastSets the contrast and separation between similar colors in this view.
- distortionEffectReturns a new view that applies shader to self as a geometric distortion effect on the location of each pixel.
- drawingGroupComposites this view's contents into an offscreen image before final display.