What I want to do
Press Button
The screen rotates (Can be executed with the following code so far)
Change the size of the Rectangle (eg. height from 250 to 100)
import SwiftUI
struct ContentView: View {
@State private var flag = false
var body: some View {
VStack {
Rectangle()
.fill(.blue)
.frame(height: 250)
.rotationEffect(Angle.degrees(flag ? 90 : 0))
.animation(.easeInOut(duration: 1), value: flag)
Button("toggle") {
flag.toggle()
}
}
}
}
How can I use SwiftUI for continuous animation such as rotation → resizing ?
2
0
522