HTGradientEasing

Showing:

Popularity

Downloads/wk

0

GitHub Stars

74

Maintenance

Last Commit

4yrs ago

Contributors

2

Package

Dependencies

2

License

MIT

Categories

Readme

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:

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100