Last updated 4 months ago
Was this helpful?
โฉ โฉ โฉ animate
Attach a modifier to the view you want to animate, and select an as well as a to monitor for changes.
struct ContentView: View { // state value @State var isOn = false // view UI var body: some View { VStack { Circle() // view modifiers (change appearances) .frame(maxHeight: 200) .foregroundColor(isOn ? .red : .yellow) .scaleEffect(isOn ? 1.0 : 0.7) // โญ๏ธ view animation .animation(.default, value: isOn) Button("Press Me") { isOn.toggle() } } } }
๏ผ