CCSpriteWithHue
CCSpriteWithHue copied to clipboard
Hue rotation for sprites in cocos2d game engine
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.
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.