Created
June 17, 2024 01:14
-
-
Save amosgyamfi/5e0b33cd19c65322752bdca04c98ad67 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// BreathRotateWiggle.swift | |
// CoreSwiftUI | |
// | |
// Created by Amos Gyamfi on 16.6.2024. | |
// | |
import SwiftUI | |
struct BreathRotateWiggle: View { | |
@State private var breathe = false | |
@State private var rotate = false | |
@State private var wiggle = false | |
var body: some View { | |
NavigationStack { | |
List { | |
Section { | |
HStack { | |
Button { | |
breathe.toggle() | |
} label: { | |
Text("Breathe") | |
} | |
Spacer() | |
Image(systemName: "leaf.arrow.trianglehead.clockwise") | |
.font(.title) | |
.bold() | |
.symbolRenderingMode(.multicolor) | |
.symbolEffect(.breathe, value: breathe) | |
} | |
} header: { | |
Text("Breathe Animation") | |
} | |
Section { | |
HStack { | |
Button { | |
rotate.toggle() | |
} label: { | |
Text("Rotate") | |
} | |
Spacer() | |
Image(systemName: "leaf.arrow.trianglehead.clockwise") | |
.font(.title) | |
.bold() | |
.symbolRenderingMode(.multicolor) | |
.symbolEffect(.rotate, value: rotate) | |
} | |
} header: { | |
Text("Rotate Animation") | |
} | |
Section { | |
HStack { | |
Button { | |
wiggle.toggle() | |
} label: { | |
Text("Wiggle") | |
} | |
Spacer() | |
Image(systemName: "leaf.arrow.trianglehead.clockwise") | |
.font(.title) | |
.bold() | |
.symbolRenderingMode(.multicolor) | |
.symbolEffect(.wiggle.left, value: wiggle) | |
} | |
} header: { | |
Text("Wiggle Animation") | |
} | |
} | |
.navigationTitle("Animation Presets: Breathe, Rotate, Wiggle") | |
.navigationBarTitleDisplayMode(.inline) | |
} | |
} | |
} | |
#Preview { | |
BreathRotateWiggle() | |
.preferredColorScheme(.dark) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment