Skip to content

Latest commit

 

History

History
25 lines (15 loc) · 1.01 KB

README.mdown

File metadata and controls

25 lines (15 loc) · 1.01 KB

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!