Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

raymondjavaxx/SmoothGradient

Repository files navigation

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 Smooth Gradient

Installation

Swift Package Manager

Add the following to your Package.swift file:

.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:

pod 'SmoothGradient', '~> 1.0.0'

Usage

Pre-iOS 17/Pre-macOS 14

import SmoothGradient
struct ContentView: View {
 var body: some View {
 LinearGradient(
 gradient: .smooth(from: .black, to: .white, curve: .easeInOut), // ⬅️
 startPoint: .top,
 endPoint: .bottom
 )
 }
}

iOS 17+/macOS 14+

import SmoothGradient
struct 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 file for more info.

About

A SwiftUI package for creating smooth gradients using easing functions.

Topics

Resources

License

Stars

Watchers

Forks

AltStyle によって変換されたページ (->オリジナル) /