Skip to content

Latest commit

 

History

History
29 lines (18 loc) · 1.21 KB

README.md

File metadata and controls

29 lines (18 loc) · 1.21 KB

CCSpriteWithHue

CCSpriteWithHue is a subclass of CCSprite from cocos2d that allows to programmatically adjust hue of the sprite.

The hue rotation technique allows you to get thousands of colorful variations of your original sprite. Supports animations and transparency.

Comparison of CCSprite' color and CCSpriteWithHue' hue

Author of the original image is Stanislav Novarenko (Lord_Lambert)

The basics of the hue rotation algorithm were borrowed from Apple's GLImageProcessing sample project

Demo

Build and run the CCSpriteWithHue-Sample project in Xcode

Example Usage

CCSpriteWithHue* sprite = [CCSpriteWithHue spriteWithFile: @"mySprite.png"];
sprite.hue = M_PI_4;

The hue property represents the hue rotation angle from 0 to 2 * π radians, but you can specify any value (it will remove full revolutions).

License

CCSpriteWithHue is available under the MIT license. See the LICENSE file for more info.