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).
- Host: GitHub
- URL: https://github.com/victorpanitz/iOS-BreathAnimation-AppleWatch-
- Owner: victorpanitz
- Created: 2018-12-27T02:10:48.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-12-28T02:02:52.000Z (over 7 years ago)
- Last Synced: 2024-11-21T02:33:28.941Z (over 1 year ago)
- Topics: animation, apple, applewatch, design, ios, iphone, swift, swift4, ui, xcode
- Language: Swift
- Size: 75.2 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-apple-watch - Breath Animation - A simple approach implementing Breath animation (Apple Watch app) (Sample Apps / Blog)
README
# Breath Animation (Smartch Watch App)
A simple approach implementing Breath animation (Apple Watch app).

---
## 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)
}
}
```