Overview
概要
A rotation gesture tracks how a rotation event sequence changes.
回転ジェスチャは、どのように回転イベントシーケンスが変化するかを追跡します。
To recognize a rotation gesture on a view, create and configure the gesture, and then add it to the view using the gesture(_:including:)
modifier.
Add a rotation gesture to a Rectangle
and apply a rotation effect:
struct RotationGestureView: View {
@State var angle = Angle(degrees: 0.0)
var rotation: some Gesture {
RotationGesture()
.onChanged { angle in
self.angle = angle
}
}
var body: some View {
Rectangle()
.frame(width: 200, height: 200, alignment: .center)
.rotationEffect(self.angle)
.gesture(rotation)
}
}