FlxGradient
| Kind | class |
| Package | flixel.util |
| Full name | flixel.util.FlxGradient |
| Source | source/source-haxelib-patches/flixel/util/FlxGradient.hx |
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
Public methods
createGradientMatrix
static function createGradientMatrix(width:Int, height:Int, colors:Array<FlxColor>, chunkSize:UInt = 1, rotation:Int = 90):GradientMatrix
| Parameter | Type | Default |
|---|---|---|
width | Int | — |
height | Int | — |
colors | Array<FlxColor> | — |
chunkSize (optional) | UInt | 1 |
rotation (optional) | Int | 90 |
createGradientArray
static function createGradientArray(width:Int, height:Int, colors:Array<FlxColor>, chunkSize:UInt = 1, rotation:Int = 90, interpolate:Bool = true):Array<FlxColor>
| Parameter | Type | Default |
|---|---|---|
width | Int | — |
height | Int | — |
colors | Array<FlxColor> | — |
chunkSize (optional) | UInt | 1 |
rotation (optional) | Int | 90 |
interpolate (optional) | Bool | true |
createGradientFlxSprite
static function createGradientFlxSprite(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.
@param width The width of the FlxSprite (and therefore gradient) @param height The height of the FlxSprite (and therefore gradient) @param colors An array of colour values for the gradient to cycle through @param chunkSize If you want a more old-skool looking chunky gradient, increase this value! @param rotation Angle of the gradient in degrees. 90 = top to bottom, 180 = left to right. Any angle is valid @param interpolate Interpolate the colours? True uses RGB interpolation, false uses linear RGB @return A FlxSprite containing your gradient (if valid parameters given!)
| Parameter | Type | Default |
|---|---|---|
width | Int | — |
height | Int | — |
colors | Array<FlxColor> | — |
chunkSize (optional) | UInt | 1 |
rotation (optional) | Int | 90 |
interpolate (optional) | Bool | true |
createGradientBitmapData
static function createGradientBitmapData(width:UInt, height:UInt, colors:Array<FlxColor>, chunkSize:UInt = 1, rotation:Int = 90, interpolate:Bool = true):BitmapData
| Parameter | Type | Default |
|---|---|---|
width | UInt | — |
height | UInt | — |
colors | Array<FlxColor> | — |
chunkSize (optional) | UInt | 1 |
rotation (optional) | Int | 90 |
interpolate (optional) | Bool | true |
overlayGradientOnFlxSprite
static function overlayGradientOnFlxSprite(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
@param dest The FlxSprite to overlay the gradient onto @param width The width of the FlxSprite (and therefore gradient) @param height The height of the FlxSprite (and therefore gradient) @param colors An array of colour values for the gradient to cycle through @param destX The X offset the gradient is drawn at (default 0) @param destY The Y offset the gradient is drawn at (default 0) @param chunkSize If you want a more old-skool looking chunky gradient, increase this value! @param rotation Angle of the gradient in degrees. 90 = top to bottom, 180 = left to right. Any angle is valid @param interpolate Interpolate the colours? True uses RGB interpolation, false uses linear RGB @return The composited FlxSprite (for chaining, if you need)
| Parameter | Type | Default |
|---|---|---|
dest | FlxSprite | — |
width | Int | — |
height | Int | — |
colors | Array<FlxColor> | — |
destX (optional) | Int | 0 |
destY (optional) | Int | 0 |
chunkSize (optional) | UInt | 1 |
rotation (optional) | Int | 90 |
interpolate (optional) | Bool | true |
overlayGradientOnBitmapData
static function overlayGradientOnBitmapData(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
@param dest The BitmapData to overlay the gradient onto @param width The width of the FlxSprite (and therefore gradient) @param height The height of the FlxSprite (and therefore gradient) @param colors An array of colour values for the gradient to cycle through @param destX The X offset the gradient is drawn at (default 0) @param destY The Y offset the gradient is drawn at (default 0) @param chunkSize If you want a more old-skool looking chunky gradient, increase this value! @param rotation Angle of the gradient in degrees. 90 = top to bottom, 180 = left to right. Any angle is valid @param interpolate Interpolate the colours? True uses RGB interpolation, false uses linear RGB @return The composited BitmapData
| Parameter | Type | Default |
|---|---|---|
dest | BitmapData | — |
width | Int | — |
height | Int | — |
colors | Array<FlxColor> | — |
destX (optional) | Int | 0 |
destY (optional) | Int | 0 |
chunkSize (optional) | UInt | 1 |
rotation (optional) | Int | 90 |
interpolate (optional) | Bool | true |