The rotation angle in degrees. Positive values rotate clockwise.
Rotates a component by the specified angle.
.rotationEffect(degrees: number): Component
.rotationEffect(props: { degrees: number; anchor?: UnitPoint }): Component
Text("Tilted")
.rotationEffect(15)
Rectangle()
.frame({ width: 50, height: 50 })
.foregroundStyle(Color("blue"))
.rotationEffect(45)
Text("Rotated")
.rotationEffect({ degrees: 30, anchor: "topLeading" })
const body = () => {
const [angle, setAngle] = useState(0)
return VStack([
Image({ systemName: "arrow.up" })
.font("largeTitle")
.rotationEffect(angle),
Button("Rotate", () => setAngle(angle + 90))
])
}