Skip to content

Instantly share code, notes, and snippets.

@amosgyamfi
Created June 17, 2024 01:14
Show Gist options
  • Save amosgyamfi/5e0b33cd19c65322752bdca04c98ad67 to your computer and use it in GitHub Desktop.
Save amosgyamfi/5e0b33cd19c65322752bdca04c98ad67 to your computer and use it in GitHub Desktop.
//
// 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