Adds a set of color gradient creation / rendering functions

@version 1.6 - May 9th 2011 @link http://www.photonstorm.com

See also:

  • Requires FlxMath

Static methods

@:value({ interpolate : true, rotation : 90, chunkSize : 1 })staticcreateGradientArray(width:Int, height:Int, colors:Array<FlxColor>, chunkSize:UInt = 1, rotation:Int = 90, interpolate:Bool = true):Array<FlxColor>

@:value({ interpolate : true, rotation : 90, chunkSize : 1 })staticcreateGradientBitmapData(width:UInt, height:UInt, colors:Array<FlxColor>, chunkSize:UInt = 1, rotation:Int = 90, interpolate:Bool = true):BitmapData

@:value({ interpolate : true, rotation : 90, chunkSize : 1 })staticcreateGradientFlxSprite(width:Int, height:Int, colors:Array<FlxColor>, chunkSize:UInt = 1, rotation:Int = 90, interpolate:Bool = true):FlxSprite

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

Parameters:

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:

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

@:value({ rotation : 90, chunkSize : 1 })staticcreateGradientMatrix(width:Int, height:Int, colors:Array<FlxColor>, chunkSize:UInt = 1, rotation:Int = 90):GradientMatrix

@:value({ interpolate : true, rotation : 90, chunkSize : 1, destY : 0, destX : 0 })staticoverlayGradientOnBitmapData(dest:BitmapData, width:Int, height:Int, colors:Array<FlxColor>, destX:Int = 0, destY:Int = 0, chunkSize:UInt = 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

Parameters:

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

@:value({ interpolate : true, rotation : 90, chunkSize : 1, destY : 0, destX : 0 })staticoverlayGradientOnFlxSprite(dest:FlxSprite, width:Int, height:Int, colors:Array<FlxColor>, destX:Int = 0, destY:Int = 0, chunkSize:UInt = 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

Parameters:

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)