Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/regexident/Rainbows
A Metal-backed, blazingly fast alternative to CAGradientLayer.
https://github.com/regexident/Rainbows
axial calayer gradient ios macos radial spiral sweep
Last synced: 12 days ago
JSON representation
A Metal-backed, blazingly fast alternative to CAGradientLayer.
- Host: GitHub
- URL: https://github.com/regexident/Rainbows
- Owner: regexident
- License: mpl-2.0
- Created: 2017-06-30T10:05:30.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2024-08-10T22:38:20.000Z (3 months ago)
- Last Synced: 2024-08-10T23:36:10.722Z (3 months ago)
- Topics: axial, calayer, gradient, ios, macos, radial, spiral, sweep
- Language: Swift
- Size: 4.02 MB
- Stars: 87
- Watchers: 3
- Forks: 6
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-blazingly-fast - Rainbows - A Metal-backed, blazingly fast alternative to CAGradientLayer. (Swift)
README
![jumbotron](jumbotron.png)
# Rainbows**Rainbows** is a **Metal-backed** alternative to `CAGradientLayer` that is **incredibly fast**. It provides drawing of **axial** (aka "linear"), **radial** (aka "circular"), **sweep** (aka "angular" aka "conical") and even trippy **spiral** gradients at **no less than 60fps**.
![screencast](screencast.gif)
## Usage
Let's say you want to add a trippy noir spiral gradient to your view:
```swift
import Rainbowslet gradientLayer = GradientLayer()
gradientLayer.gradient = Gradient(colors: [
UIColor.black.cgColor, UIColor.white.cgColor
])
gradientLayer.configuration = .spiral(
center: CGPoint(x: 0.5, y: 0.5),
angle: 0.0 * CGFloat.pi * 2.0,
scale: 1.0
)
gradientLayer.frame = view.layer.bounds
view.layer.addSublayer(gradientLayer)
```Or just skip the detour via `self.layer` and use a convenient `GradientView`:
```swift
import Rainbowslet gradientView = GradientView()
gradientView.gradient = Gradient(colors: [
UIColor.black.cgColor, UIColor.white.cgColor
])
gradientView.configuration = .spiral(
center: CGPoint(x: 0.5, y: 0.5),
angle: 0.0 * CGFloat.pi * 2.0,
scale: 1.0
)
```## Installation
The recommended way to add **Rainbows** to your project is via [Carthage](https://github.com/Carthage/Carthage):
github 'regexident/Rainbows'
## License
**Rainbows** is available under the **MPL-2.0 license**. See the `LICENSE` file for more info.