Skip to content

nalexn/CCSpriteWithHue

Repository files navigation

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.

About

Hue rotation for sprites in cocos2d game engine

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages