class flixel.util.FlxGradient

Available on all platforms

Adds a set of color gradient creation / rendering functions * * @version 1.6 - May 9th 2011 * @link http://www.photonstorm.com * @author Richard Davey / Photon Storm * @see Requires FlxMath

Class Fields

static function createGradientArray(width:Int, height:Int, colors:Array<Int>, ?chunkSize:Int = 1, ?rotation:Int = 90, ?interpolate:Bool = true):Array<Int>

static function createGradientBitmapData(width:Int, height:Int, colors:Array<Int>, ?chunkSize:Int = 1, ?rotation:Int = 90, ?interpolate:Bool = true):BitmapData

static function createGradientFlxSprite(width:Int, height:Int, colors:Array<Int>, ?chunkSize:Int = 1, ?rotation:Int = 90, ?interpolate:Bool = true):FlxSprite

Creates an FlxSprite of the given width/height with a colour gradient flowing through it. * *

width

The width of the FlxSprite (and therefore gradient) *

height

The height of the FlxSprite (and therefore gradient) *

colors

An array of colour values for the gradient to cycle through *

chunkSize

If you want a more old-skool looking chunky gradient, increase this value! *

rotation

Angle of the gradient in degrees. 90 = top to bottom, 180 = left to right. Any angle is valid *

interpolate

Interpolate the colours? True uses RGB interpolation, false uses linear RGB * *

returns

An FlxSprite containing your gradient (if valid parameters given!)

static function createGradientMatrix(width:Int, height:Int, colors:Array<Int>, ?chunkSize:Int = 1, ?rotation:Int = 90):GradientMatrix

static function overlayGradientOnBitmapData(dest:BitmapData, width:Int, height:Int, colors:Array<Int>, ?destX:Int = 0, ?destY:Int = 0, ?chunkSize:Int = 1, ?rotation:Int = 90, ?interpolate:Bool = true):BitmapData

Creates a new gradient and overlays that on-top of the given BitmapData at the destX/destY coordinates (default 0,0) * Use low alpha values in the colours to have the gradient overlay and not destroy the image below * *

dest

The BitmapData to overlay the gradient onto *

width

The width of the FlxSprite (and therefore gradient) *

height

The height of the FlxSprite (and therefore gradient) *

colors

An array of colour values for the gradient to cycle through *

destX

The X offset the gradient is drawn at (default 0) *

destY

The Y offset the gradient is drawn at (default 0) *

chunkSize

If you want a more old-skool looking chunky gradient, increase this value! *

rotation

Angle of the gradient in degrees. 90 = top to bottom, 180 = left to right. Any angle is valid *

interpolate

Interpolate the colours? True uses RGB interpolation, false uses linear RGB *

returns

The composited BitmapData

static function overlayGradientOnFlxSprite(dest:FlxSprite, width:Int, height:Int, colors:Array<Int>, ?destX:Int = 0, ?destY:Int = 0, ?chunkSize:Int = 1, ?rotation:Int = 90, ?interpolate:Bool = true):FlxSprite

Creates a new gradient and overlays that on-top of the given FlxSprite at the destX/destY coordinates (default 0,0) * Use low alpha values in the colours to have the gradient overlay and not destroy the image below * *

dest

The FlxSprite to overlay the gradient onto *

width

The width of the FlxSprite (and therefore gradient) *

height

The height of the FlxSprite (and therefore gradient) *

colors

An array of colour values for the gradient to cycle through *

destX

The X offset the gradient is drawn at (default 0) *

destY

The Y offset the gradient is drawn at (default 0) *

chunkSize

If you want a more old-skool looking chunky gradient, increase this value! *

rotation

Angle of the gradient in degrees. 90 = top to bottom, 180 = left to right. Any angle is valid *

interpolate

Interpolate the colours? True uses RGB interpolation, false uses linear RGB *

returns

The composited FlxSprite (for chaining, if you need)