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.
Examples
taccgl.actor("eximg").alpha(0).bgColor("red","yellow").start(); | RUN |
taccgl.actor("eximg").blend(0,0).bgColor("red","rgba(0,0,0,0.0)").start(); | RUN |
taccgl.actor("eximg").alpha(0.5).bgColor("red").start(); | RUN |
taccgl.actor("eximg").alpha(1,0).bgColor("red").start(); | RUN |
taccgl.actor("eximg").bgColor("red").start(); | RUN |
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.
|