Skip to content

Instantly share code, notes, and snippets.

@twostraws
Created March 13, 2020 21:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save twostraws/c69e4080099ae7ac45bfd9b1e15a4269 to your computer and use it in GitHub Desktop.
Save twostraws/c69e4080099ae7ac45bfd9b1e15a4269 to your computer and use it in GitHub Desktop.
A quick clone of the watchOS Breathe UI, for Swift Over Coffee
//
// 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