HTML5 Canvas 3D WebGL (TM) js Library

color Library Method

Short Description: Set color / color animation

Signature: t.color (c,c1)
Group: Texture
Class: transition Class

Fills the animated object with the given color c. If c1 is given, this performs an animation changing the color from c to c1. Color values are strings that form a valid canvas fillStyle. Colors may be partially transparent. Default color is "fully transparent".

The method also sets the alpha value to 0 so that a texture is not visible, just the color given. If, however, alpha or blend is used afterwards, the color method actuall acts like bgColor.

Examples"eximg").color("red").start(); RUN"eximg").color("red","yellow").start(); RUN"eximg").color("red","rgba(0,0,0,0.0)").start(); RUN"eximg").color("red").alpha(0.5).start(); RUN"eximg").color("red").alpha(1,0).start(); RUN

The methods color, bgColor, lightAmbDiff, and lightBgAmbDiff are mutually exclusive, only one of them can be used for a single transition. This color method has the advantage that a color animation in the background color can be performed. On the other hand default values for the ambient and diffuse lighting factors will be used, as specified in taccgl.Lighting Parameters. Alternatively you can use lightBgAmbDiff which allows to set the background color and values for the ambient and diffuse lighting factors.

WebGL™ is a trademark of the Khronos Group Inc.

Next Page:transition.bgColor - Set background color / color animation
Previous Page: transition.alpha - Set Texture Opacity