---
title: "rotation(_:anchor:)"
framework: swiftui
role: symbol
role_heading: Instance Method
path: "swiftui/shape/rotation(_:anchor:)"
---

# rotation(_:anchor:)

Rotates this shape around an anchor point at the angle you specify.

## Declaration

```swift
nonisolated func rotation(_ angle: Angle, anchor: UnitPoint = .center) -> RotatedShape<Self>
```

## Parameters

- `angle`: The angle of rotation to apply. Positive angles rotate clockwise; negative angles rotate counterclockwise.
- `anchor`: The point to rotate the shape around.

## Return Value

Return Value A rotated shape.

## Discussion

Discussion The following example rotates a square by 45 degrees to the right to create a diamond shape: RoundedRectangle(cornerRadius: 10) .rotation(Angle(degrees: 45)) .aspectRatio(1.0, contentMode: .fit)

## See Also

### Transforming a shape

- [trim(from:to:)](swiftui/shape/trim(from:to:).md)
- [transform(_:)](swiftui/shape/transform(_:).md)
- [size(_:)](swiftui/shape/size(_:).md)
- [size(width:height:)](swiftui/shape/size(width:height:).md)
- [scale(_:anchor:)](swiftui/shape/scale(_:anchor:).md)
- [scale(x:y:anchor:)](swiftui/shape/scale(x:y:anchor:).md)
- [offset(_:)](swiftui/shape/offset(_:).md)
- [offset(x:y:)](swiftui/shape/offset(x:y:).md)
