Giter Site home page Giter Site logo

irregulargradient's Introduction

IrregularGradient

Twitter: @joogps

A SwiftUI library for rendering beautiful, animated and irregular gradient views.

Installation

Since this is a Swift package, it can be installed via the Swift Package Manager. To do this, all you gotta do is open your Xcode project, add a new depedency under File > Swift Package Manager, search for this repo and install it. Then, it's all done!

Usage

To use this library all you gotta do is add import IrregularGradient to the file you're using and then add an irregular gradient to any view you want with the irregularGradient(colors: [Color], backgroundColor: Color = .clear, animate: Binding<Bool> = .constant(true), speed: Double = 10) modifier.

  • The first argument (and the only required one) colors specifies the colors of each gradient blob. Order and quantity matters, so the last color you add will always stay on top, and having two blues will create two separate blue blobs.
  • The backgroundColor argument defines the background color of your gradient, which will occupy the full container (not specifying it will make it transparent).
  • animate is a boolean binding that specifies wheter or not the gradient should perform its natural movement. It can be enabled and disabled dinamically, but movement will never stop abruptly.
  • The speed argument accepts a Double and defines how fast the blobs move and update.
RoundedRectangle(cornerRadius: 30.0, style: .continuous)
    .irregularGradient(colors: [.orange, .pink, .yellow, .orange, .pink, .yellow], backgroundColor: .orange)

You can also use the IrregularGradientView which works the exact same way except for the fact that instead of filling an already existing view, it exists in its own container.

Questions

If you have any questions or suggestions, you can create an issue on this repo or even contact me via Twitter or email!

irregulargradient's People

Contributors

joogps avatar julianschiavo 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.