Git Product home page Git Product logo

smooth-gradient's Introduction

Smooth gradients on iOS using CGShading

This project includes the class JSTGradientView which is a UIView subclass that can be used wherever a smooth gradient is needed. This is a replacement for manually drawing a gradient using CGGradient. The class used CGShading internally instead. To see why, look at the two images below:

Smooth Regular

The first one is drawn using JSTGradientView with an interpolation factor of 2, the second one is drawn using CGGradient. Guess which one designers usually put in their designs? Yep, the first one. Most image editing software does a better job at interpolating colors than CGGradient and to mimic that JSTGradientView was born.

Check out the code and sample app to see how the interpolation factor affects the gradient.

A full Swift 2 version of the class is available in the branch swift2.

Setup

Carthage

Start by adding the following line to your Cartfile.

github "jernejstrasner/Smooth-Gradient" ~> 1.0

The run

carthage update

and add the built frameworks to your Xcode project.

Full instructions on installing dependencies with Carthage can be found in Carthage's README.

smooth-gradient's People

Contributors

jernejstrasner avatar

Watchers

James Cloos 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.