An open API service indexing awesome lists of open source software.

https://github.com/victorpanitz/iOS-BreathAnimation-AppleWatch-

A simple approach implementing Breath animation (Apple Watch app).
https://github.com/victorpanitz/iOS-BreathAnimation-AppleWatch-

animation apple applewatch design ios iphone swift swift4 ui xcode

Last synced: 12 months ago
JSON representation

A simple approach implementing Breath animation (Apple Watch app).

Awesome Lists containing this project

README

          

# Breath Animation (Smartch Watch App)
A simple approach implementing Breath animation (Apple Watch app).

![alt text](https://media.giphy.com/media/4W1OIQ6hFBUbRtnTac/giphy.gif)


---

## Flexible

This model is able to receive animation settings as duration, repeat count and autoreverse. Generate your breath animating using `BreathLayerGenerator` choosing the number of circles you want.


```Swift
import UIKit

final class BreathViewController: UIViewController {

var generator: BreathLayerGenerator?
var animator: BreathAnimator?
lazy var layers = [CAShapeLayer]()

override func viewDidLoad() {
super.viewDidLoad()

view.backgroundColor = .black

generator = BreathLayerGenerator(center: view.center)
animator = BreathAnimator(duration: 4, repeatCount: 3, autoreverse: true)

setupBreath()
}

private func setupBreath(){
guard let layers = generator?.generateLayers(numberOfLayers: 6) else { return }
layers.forEach { view.layer.addSublayer($0) }

animator?.animate(layers: layers)
}
}
```