Skip to content

UIColor category to cross fade between two UIColors at a specific ratio

Notifications You must be signed in to change notification settings

peyton/UIColor-CrossFade

 
 

Repository files navigation

UIColor+CrossFade

UIColor+CrossFade is a UIColor category adding a class method to return a UIColor created by cross fading between the two specified UIColor objects at the specified ratio (between 0.0 and 1.0).

For now, to grab InfColorPicker (which is needed for the demo), use the following when cloning UIColor+CrossFade for the first time:

git clone git://github.com/cbpowell/UIColor-CrossFade.git --recursive

Using UIColor+CrossFade:

Import UIColor+CrossFade.h, and use as follows:

UIColor *colorA = [UIColor redColor];
UIColor *colorB = [UIColor blueColor];
UIColor *crossFade = [UIColor colorForFadeBetweenFirstColor:colorA secondColor:colorB atRatio:0.5f];
// crossFade is purple

At a ratio of 0.0f, the result will be fully firstColor At a ratio of 1.0f, the result will be fully secondColor

See the included UIColorCrossFadeDemo project, which uses the extremely handy InfColorPicker, for further example usage.

If you use this in your app, I'd love to hear about it!

About

UIColor category to cross fade between two UIColors at a specific ratio

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Objective-C 100.0%