Created
March 13, 2020 21:39
-
-
Save twostraws/c69e4080099ae7ac45bfd9b1e15a4269 to your computer and use it in GitHub Desktop.
A quick clone of the watchOS Breathe UI, for Swift Over Coffee
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
// | |
// Gasp – a quick clone of the watchOS Breathe UI, for Swift Over Coffee | |
// https://github.com/twostraws/SwiftOverCoffee | |
// | |
import SwiftUI | |
struct ContentView: View { | |
@State private var flowerOut = false | |
var body: some View { | |
ZStack { | |
Color.black.edgesIgnoringSafeArea(.all) | |
ZStack { | |
ForEach(0..<6) { | |
Circle() | |
.foregroundColor(Color(red: 0.6, green: 0.9, blue: 0.8)) | |
.frame(width: 200, height: 200) | |
.offset(x: self.flowerOut ? 100 : 0) | |
.rotationEffect(.degrees(Double($0) * 60)) | |
.blendMode(.hardLight) | |
} | |
} | |
.rotationEffect(.degrees(flowerOut ? 120 : 0)) | |
.scaleEffect(flowerOut ? 1 : 0.25) | |
.animation(Animation.easeInOut(duration: 4).delay(0.75).repeatForever(autoreverses: true)) | |
.onAppear() { | |
self.flowerOut.toggle() | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment