DirectAnimation Animated Header --Static Methods Relevant to ColorBvr Objects DirectAnimation Animated Header --Static Methods Relevant to ColorBvr Objects* Microsoft DirectAnimation SDK
*Index  *Topic Contents
*Previous Topic: Static Methods Relevant to CameraBvr Objects
*Next Topic: Static Fields Relevant to ColorBvr Objects

Static Methods Relevant to ColorBvr Objects



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. 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));

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

Parameters
h
A 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
A 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
A 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 Values

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.

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. 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));

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

Parameters
r, g, and b
The 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 Values

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.

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].

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

Parameters
r, g, and b
The 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 Values

Returns the ColorBvr object.

© 1998 Microsoft Corporation. All rights reserved. Terms of Use.

*Top of Page