HTML5 Canvas 3D WebGL (TM) javaScript Library
 

color Library Method

Short Description: Set background color / color animation

Signature: x.color (c,c1)
Group: Texture
Class: taccglMaterial 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.

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.

Examples

var m=taccgl.material().color("red"); taccgl.actor("logoimg").material(m).paint().start(); RUN
var m=taccgl.material().color("red"); taccgl.actor("testimg").paint().material(m).blend(0.5,0).start(); RUN
var m=taccgl.material().color("red"); taccgl.actor("testimg").paint().material(m).blend(1,0,0,0).start(); RUN
var m=taccgl.material().color("red","yellow"); taccgl.actor("testimg").material(m).paint().blend(0,0).start(); RUN
var m=taccgl.material().color("red","rgba(0,0,0,0.0)"); taccgl.actor("testimg").material(m).paint().blend(0,0).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.

Next Page:taccglMaterial.lightAmbDiff - Set ambient and diffuse color
Previous Page: taccglMaterial Class
Please Add a Comment or Question, click here!