Statics Methods Relevant to ColorBvr Objects

colorHsl Creates a color behavior that represents a color given by hue, saturation, and lightness values.
colorRgb Creates a color behavior that represents a color given by red, green, and blue intensity values.
colorRgb255 Creates a color behavior that represents a color given by red, green, and blue intensity values. These values can be in the range [0, 255].

colorHsl

Statics Class

Creates a color behavior that represents a color given by hue, saturation, and lightness values. The behavior's value at any given time depends on the values of h, s, and l.

Syntax

public static ColorBvr colorHsl( NumberBvr h, NumberBvr s, NumberBvr l );

Parameters

h
NumberBvr object specifying the hue or base color. 0.0 is red, 0.33 is green, and 0.67 is blue. This number is considered "modulo 1," which means, for example, that the numbers 1.67, and 0.67 are both considered to be 0.67. This parameter can also be of type double.
s
NumberBvr object specifying saturation or intensity of the hue. If saturation is 0.0, the color produced is gray regardless of the hue value. This parameter can also be of type double.
l
NumberBvr object specifying lightness or amount of white in the color. If lightness is 1.0, the color produced is white regardless of the hue and saturation values. Similarly, if lightness is 0.0, the color is black. This parameter can also be of type double.

Return Value

Returns the ColorBvr object.

Remarks

Hue, saturation, and lightness values can range from 0.0 to 1.0. If the corresponding number behavior has a value outside this range, then the number is considered modulo 1.

Example

The following example creates a color whose hue varies with time, but whose saturation and lightness values are constant:

//vary the hue over time
ColorBvr animCol = colorHsl(localTime, toBvr(0.5), toBvr(0.5));

See Also

colorRgb

colorRgb

Statics Class

Creates a color behavior that represents a color given by red, green, and blue intensity values. The behavior's value at any given time depends on the values of r, g, and b.

Syntax

public static ColorBvr colorRgb( NumberBvr r, NumberBvr g, NumberBvr b );

Parameters

r, g, and b
NumberBvr objects specifying the red, green, and blue values, respectively. The value of each specifies that color's intensity, with 0.0 for no color and 1.0 for the highest possible intensity. These parameters can also be of type double.

Return Value

Returns the ColorBvr object.

Remarks

Intensity values can range from 0.0 to 1.0. If the corresponding number behavior has a value outside this range, the integer part of the value is discarded and only the fractional part is used.

Example

The following example creates a color behavior whose red component varies from 0 to 1:

//Create a sawtooth wave that goes repetitively from 0 to 1
//Do this by taking the modulus of localTime and 1
NumberBvr sawtooth = mod(localTime, toBvr(1));

//Now create the RGB color, making red = to the value
//of sawtooth
ColorBvr col = colorRgb(sawtooth, toBvr(0), toBvr(0));

See Also

colorHsl

colorRgb255

Statics Class

Creates a color behavior that represents a color given by red, green, and blue intensity values. The behavior's value at any given time depends on the values of r, g, and b. These values can be in the range [0, 255].

Syntax

public static ColorBvr colorRgb255( short r, short g, short b );

Parameters

r, g, and b
Shorts specifying the red, green, and blue values, respectively. The value of each specifies that color's intensity, with 0 for no color and 255 for the highest possible intensity.

Return Value

Returns the ColorBvr object.


Top of Page Top of Page
© 2000 Microsoft and/or its suppliers. All rights reserved. Terms of Use.