Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/raymondjavaxx/smoothgradient
A SwiftUI package for creating smooth gradients using easing functions.
https://github.com/raymondjavaxx/smoothgradient
easing gradient ios macs swift swiftui
Last synced: 16 days ago
JSON representation
A SwiftUI package for creating smooth gradients using easing functions.
- Host: GitHub
- URL: https://github.com/raymondjavaxx/smoothgradient
- Owner: raymondjavaxx
- License: mit
- Created: 2023-08-04T02:20:37.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-08-31T21:30:38.000Z (5 months ago)
- Last Synced: 2025-01-08T23:33:54.851Z (17 days ago)
- Topics: easing, gradient, ios, macs, swift, swiftui
- Language: Swift
- Homepage:
- Size: 1.77 MB
- Stars: 62
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# SmoothGradient
A SwiftUI framework for creating smooth gradients using easing functions.
## Motivation
Linear gradients tend to produce hard edges, which are more noticeable when transitioning between highly contrasting colors. This framework provides a simple way to create smoother gradients using easing functions.
| Linear | Smooth |
| --- | --- |
| ![Linear Gradient](assets/linear_gradient.png) | ![Smooth Gradient](assets/smooth_gradient.png) |## Installation
### Swift Package Manager
Add the following to your `Package.swift` file:
```swift
.package(url: "https://github.com/raymondjavaxx/SmoothGradient.git", from: "1.0.0")
```To add from Xcode, go to *File* -> *Add Package Dependencies...* and enter the URL above.
### CocoaPods
Add the following to your `Podfile`:
```ruby
pod 'SmoothGradient', '~> 1.0.0'
```## Usage
### Pre-iOS 17/Pre-macOS 14
```swift
import SmoothGradientstruct ContentView: View {
var body: some View {
LinearGradient(
gradient: .smooth(from: .black, to: .white, curve: .easeInOut), // ⬅️
startPoint: .top,
endPoint: .bottom
)
}
}
```## iOS 17+/macOS 14+
```swift
import SmoothGradientstruct ContentView: View {
var body: some View {
SmoothLinearGradient( // ⬅️
from: .black,
to: .white,
startPoint: .top,
endPoint: .bottom,
curve: .easeInOut
)
}
}
```## License
SmoothGradient is available under the MIT license. See the [LICENSE](LICENSE) file for more info.