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.
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
Build and run the CCSpriteWithHue-Sample
project in Xcode
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).
CCSpriteWithHue
is available under the MIT license. See the LICENSE file for more info.