Skip to content

Instantly share code, notes, and snippets.

@twostraws
Created Mar 13, 2020
Embed
What would you like to do?
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