https://github.com/lotus-ios/lotus
A Swift animation DSL for animating layers with help of CoreAnimation
https://github.com/lotus-ios/lotus
cocoapods coreanimation ios layer-animation library swift
Last synced: 4 months ago
JSON representation
A Swift animation DSL for animating layers with help of CoreAnimation
- Host: GitHub
- URL: https://github.com/lotus-ios/lotus
- Owner: lotus-ios
- License: mit
- Created: 2019-08-12T11:26:19.000Z (almost 7 years ago)
- Default Branch: develop
- Last Pushed: 2020-02-24T06:51:55.000Z (over 6 years ago)
- Last Synced: 2026-01-14T10:36:07.116Z (5 months ago)
- Topics: cocoapods, coreanimation, ios, layer-animation, library, swift
- Language: Swift
- Homepage:
- Size: 4.74 MB
- Stars: 15
- Watchers: 3
- Forks: 2
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Lotus

[](https://travis-ci.org/lotus-ios/lotus)
[](https://codecov.io/gh/lotus-ios/lotus)
[](http://cocoapods.org/pods/Lotus)
[](https://github.com/lotus-ios/lotus/blob/develop/LICENSE)
[](http://cocoapods.org/pods/Lotus)
**Lotus** – powerful nano framework that helps implement layer animation with easy syntax. This DSL relieves you from routine code of making animations via CoreAnimation.

```swift
for i in 0..<10 {
let petalLayer = PetalLayer()
petalLayer.position = CGPoint(x: view.frame.width / 2, y: view.frame.height / 2 + 60)
let direction: CGFloat = i % 2 == 0 ? -1.0 : 1.0
let initialRotationDegree = 3.0 * CGFloat(i / 2) * .pi / 180.0
let rotateTransform = CGAffineTransform.identity.rotated(by: direction * initialRotationDegree)
petalLayer.setAffineTransform(rotateTransform)
view.layer.addSublayer(petalLayer)
let rotationDegree = 12.0 * CGFloat(i / 2) * .pi / 180.0
petalLayer.lotus.runAnimation { make in
make.opacity.to(0.7).during(0.7).delay(1.0)
}.then { make in
make.rotation.to(direction * rotationDegree).during(0.6)
}.then { make in
make.scaling.to(1.2).delay(0.3).during(1.5).ease(.outElastic)
}
}
```
## Contents
- [Getting started](#getting-started)
- [Requirements](#requirements)
- [Installing](#installing)
- [Usage](#usage)
- [Documentation](#documentation)
- [Contributing](#contributing)
- [Authors](#authors)
- [License](#license)
## Getting started
These instructions will help you to integrate Lotus into your project.
### Requirements
- Xcode 10.2+
### Installing
#### CocoaPods
1\. In terminal switch to your repository with project
2\. Specify Lotus in your `Podfile`:
```ruby
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '10.0'
use_frameworks!
target '' do
pod 'Lotus'
end
```
3\. Run `pod install` command
### Usage
1\. Import Lotus into your project
```swift
import Lotus
```
2\. Create any layer and add to `view`'s hierarchy
```swift
let redSquareLayer = CALayer()
redSquareLayer.frame = CGRect(x: 50, y: 50, width: 100, height: 100)
view.layer.addSublayer(redSquareLayer)
```
3\. Then run any needed animation whenever you need
```swift
redSquareLayer.lotus.runAnimation { make in
make.scaling.to(2.0)
}
```
## Documentation
Find out all accessible facilities in [Documentation](https://lotus-ios.github.io/)
## Contributing
If you found any bug, have great new feature or want to improve documentation – you're welcome! Go to [issue page](https://github.com/lotus-ios/lotus/issues "Issues"), choose template, write details and we will answer you as soon as possible.
## Authors
- **Vladislav Kondrashkov** - _Initial work_ - [vkondrashkov](https://github.com/vkondrashkov "Vladislav Kondrashkov")
- **Pavel Kondrashkov** - _Mentor, idea contributor_ - [pkondrashkov](https://github.com/pkondrashkov "Pavel Kondrashkov")
See also the list of [contributors](https://github.com/lotus-ios/lotus/graphs/contributors "Contributors") who participated in this project.
## License
This project is licensed under the MIT License - see the [LICENSE.md](https://github.com/lotus-ios/lotus/blob/develop/LICENSE "MIT License") file for details