<!--
{
  "availability" : [
    "iOS: 13.0.0 -",
    "iPadOS: 13.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.15.0 -",
    "tvOS: 13.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 6.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/View/rotation3DEffect(_:axis:anchor:anchorZ:perspective:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI4ViewPAAE16rotation3DEffect_4axis6anchor0G1Z11perspectiveQrAA5AngleV_14CoreFoundation7CGFloatV1x_AM1yAM1ztAA9UnitPointVA2MtF"
  },
  "title" : "rotation3DEffect(_:axis:anchor:anchorZ:perspective:)"
}
-->

# rotation3DEffect(_:axis:anchor:anchorZ:perspective:)

Renders a view’s content as if it’s rotated in three dimensions around
the specified axis.

```
nonisolated func rotation3DEffect(_ angle: Angle, axis: (x: CGFloat, y: CGFloat, z: CGFloat), anchor: UnitPoint = .center, anchorZ: CGFloat = 0, perspective: CGFloat = 1) -> some View
```

## Parameters

`angle`

The angle by which to rotate the view’s content.

`axis`

The axis of rotation, specified as a tuple with named
elements for each of the three spatial dimensions.

`anchor`

A two dimensional unit point within the view about which to
perform the rotation. The default value is [`center`](/documentation/SwiftUI/UnitPoint/center).

`anchorZ`

The location on the z-axis around which to rotate the
content. The default is `0`.

`perspective`

The relative vanishing point for the rotation. The
default is `1`.

## Return Value

A view with rotated content.

## Discussion

Use this method to create the effect of rotating a view in three
dimensions around a specified axis of rotation. The modifier projects
the rotated content onto the original view’s plane. Use the
`perspective` value to control the renderer’s vanishing point. The
following example creates the appearance of rotating text 45˚ about
the y-axis:

```
Text("Rotation by passing an angle in degrees")
    .rotation3DEffect(
        .degrees(45),
        axis: (x: 0.0, y: 1.0, z: 0.0),
        anchor: .center,
        anchorZ: 0,
        perspective: 1)
    .border(Color.gray)
```

![A screenshot of text in a grey box. The text says Rotation by passing an angle in degrees. The text is rendered in a way that makes it appear farther from the viewer on the right side and closer on the left, as if the text is angled to face someone sitting on the viewer’s right.](images/com.apple.SwiftUI/SwiftUI-View-rotation3DEffect@2x.png)

> Important: In visionOS, create this effect with
> ``doc://com.apple.SwiftUI/documentation/SwiftUI/View/perspectiveRotationEffect(_:axis:anchor:anchorZ:perspective:)``
> instead. To truly rotate a view in three dimensions,
> use a 3D rotation modifier without a perspective input like
> ``doc://com.apple.SwiftUI/documentation/SwiftUI/View/rotation3DEffect(_:axis:anchor:)``.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)