Latest 0.0.8
Homepage https://github.com/alexandre-g/HTGradientEasing
License MIT
Platforms ios 4.3, requires ARC
Dependencies AHEasing, UIColor-CrossFade
Frameworks QuartzCore, CoreGraphics
Authors

HotelTonight

HTGradientEasing

Overview

Easily add smooth easing to CAGradientLayers. A combination of the exhaustive collection of easing functions provided by the AHEasing project and a color mixer, UIColor+CrossFade.

There’s this optical illusion called the Mach Bands effect:

The Mach Bands effect exaggerates our perception of the hard lines at the ends of linear gradients. Eased gradients tend to look better.

Installation

Include the following line in your podfile:

pod 'HTGradientEasing'

If you do not use cocoapods, you must install dependencies AHEasing and UIColor+Crossfade.

Usage

A category on CAGradientLayer is provided with the interface:

- (void)setEasedGradientColors:(NSArray *)colors
                     locations:(NSArray *)locations
                easingFunction:(AHEasingFunction)easingFunction
     keyframesBetweenLocations:(NSUInteger)keyframesBetweenLocations;

Colors must be UIColors, and locations NSNumbers in [0,1]. A great variety of easing functions may be passed (quintic/sine/quadratic ease in/out/inout etc)

Example:

[gradientLayer setEasedGradientColors:@[[UIColor redColor], [UIColor blueColor]]
                            locations:@[@0, @1]
                       easingFunction:QuadraticEaseInOut
            keyframesBetweenLocations:6];

Demo project in action

HotelTonight

Use it? Love/hate it?

Tweet the author @jakejennings, and check out HotelTonight’s engineering blog: http://engineering.hoteltonight.com

Also, check out HotelTonight’s other iOS open source:

Latest podspec

{
    "name": "HTGradientEasing-Fixed",
    "version": "0.0.8",
    "platforms": {
        "ios": "4.3"
    },
    "summary": "Fixed improper import for use as dependency",
    "homepage": "https://github.com/alexandre-g/HTGradientEasing",
    "license": "MIT",
    "authors": {
        "Alex": "[email protected]"
    },
    "source": {
        "git": "https://github.com/alexandre-g/HTGradientEasing.git",
        "tag": "0.0.8"
    },
    "source_files": "*.{h,m}",
    "frameworks": [
        "QuartzCore",
        "CoreGraphics"
    ],
    "requires_arc": true,
    "dependencies": {
        "AHEasing": [],
        "UIColor-CrossFade": []
    }
}

Pin It on Pinterest

Share This