HTML5+CSS on Canvas 3D WebGL (TM) Library

bgColor Library Method

Short Description: Set background color / color animation

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

Fills the animated object with the given background 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 colored background is located behind a possible background of the animated HTML element and so becomes visible only if (1) the HTML element has no (or transparent) background and a partly (semi-)transparent foreground, or (2) blend is used to make it transparent.

Note that the last example shows a common error and does not have a visual effect. Because the texture image is not transparent it fully covers the background and no color is visible.


The methods color, 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.paint - Paint HTML element on texture canvas
Previous Page: transition.color - Set color / color animation