Coder Social home page Coder Social logo

raymondjavaxx / smoothgradient Goto Github PK

View Code? Open in Web Editor NEW
27.0 3.0 0.0 1.8 MB

A SwiftUI package for creating smooth gradients using easing functions.

License: MIT License

Swift 96.47% Makefile 0.47% Ruby 3.06%
swiftui gradient ios macs swift easing

smoothgradient's Introduction

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.

smoothgradient's People

Contributors

raymondjavaxx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.