import SwiftUI
struct ContentView: View {
@State var breatheOut = false
@State var breatheIn = true
var body: some View {
ZStack {
Color.black
.edgesIgnoringSafeArea(.all)
Text("Breathe In")
.foregroundColor(.white)
.opacity(breatheIn ? 0 : 1)
.scaleEffect(breatheIn ? 0 : 1, anchor: .center)
.animation(Animation.easeInOut(duration: 4)
.delay(0.75)
.repeatForever(autoreverses: true))
.onAppear {
breatheIn.toggle()
}
Text("Breathe Out")
.foregroundColor(.white)
.opacity(breatheOut ? 0 : 1)
.animation(Animation.easeInOut(duration: 4)
.delay(0.75)
.repeatForever(autoreverses: true))
.onAppear {
breatheOut.toggle()
}
}
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}
Last active
May 9, 2021 02:11
-
-
Save KentarouKanno/30cdb42bae7afdc73e5c07309ca3404c to your computer and use it in GitHub Desktop.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment