Fork me on GitHub
View source

package haxepunk.utils

abstract Color

An abstract with various color utility functions.


Available since:

4.0.0

Class Fields

View source

read only Black : Color

View source

read only White : Color

View source

colorLerp (fromColor : Color, toColor : Color, t : Float = 1) : Color

Linear interpolation between two colors.


Parameters:
fromColor   

First color.

toColor   

Second color.

t   

Interpolation value. Clamped to the range [0, 1]. return RGB component-interpolated color value.

View source

getColorHSV (h : Float, s : Float, v : Float) : Color

Creates a color value with the chosen HSV values.


Parameters:
h   

The hue of the color (from 0 to 1).

s   

The saturation of the color (from 0 to 1).

v   

The value of the color (from 0 to 1).


Returns:

The color Int.

View source

getColorRGB (r : Int = 0, g : Int = 0, b : Int = 0) : Color

Creates a color value by combining the chosen RGB values.


Parameters:
R   

The red value of the color, from 0 to 255.

G   

The green value of the color, from 0 to 255.

B   

The blue value of the color, from 0 to 255.


Returns:

The color.

View source

getColorRGBFloat (r : Float, g : Float, b : Float) : Color

Instance Fields

read only a : UInt

read only alpha : Float

read only b : UInt

read only blue : Float

read only g : UInt

read only green : Float

read only r : UInt

read only red : Float

View source

getHue () : Float

Finds the hue factor of a color.


Returns:

The hue value (from 0 to 1).

View source

getSaturation () : Float

Finds the saturation factor of a color.


Returns:

The saturation value (from 0 to 1).

View source

getValue () : Float

Finds the value factor of a color.


Returns:

The value value (from 0 to 1).

View source

lerp (toColor : Color, t : Float = 1) : Color

Shortcut to lerp between this color and another.


Parameters:
toColor   

Second color.

t   

Interpolation value. Clamped to the range [0, 1].

View source

toARGB (alpha : Float) : UInt

View source

withAlpha (a : Float) : Color