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

specLight Library Method

Short Description: Set specular light factor and shininess

Signature: x.specLight (spec,shininess)
Class: taccglMaterial Class
 

Defines the amount of specular light reflected and the shininess for the current transition. spec is a non-negative value <1 giving the specular light factor. Specular lights have the color of the light source (white by default) multiplied by the specular light factor. The shininess must be an integer between 1 and 1024. The bigger the more shiny the material appears and smaller specular lights appear.

Note that, in the examples below, you can see the specular lights only at a certain rotation angle. The first example shows the default value. The second one disables specular lights by setting spec to 0. The following examples show various shininess values. The last example shows that specular lights are better visible, if ambient and diffuse lights are a bit reduced.

Examples

taccgl.actor("Layout").rotateMiddle(0,1,0).dur(7).start();
RUN
var m=taccgl.material().specLight(0,1); taccgl.actor("Layout").material(m).rotateMiddle(0,1,0).dur(7).start();
RUN
var m=taccgl.material().specLight(0.5,16); taccgl.actor("Layout").material(m).rotateMiddle(0,1,0).dur(7).start();
RUN
var m=taccgl.material().specLight(0.5,128); taccgl.actor("Layout").material(m).rotateMiddle(0,1,0).dur(7).start();
RUN
var m=taccgl.material().specLight(0.5,512); taccgl.actor("Layout").material(m).rotateMiddle(0,1,0).dur(7).start();
RUN
var m=taccgl.material() .lightAmbDiff("rgb(65,65,65)","rgb(160,160,160)") .specLight(0.5,512);
taccgl.actor("Layout").material(m).rotateMiddle(0,1,0).dur(7).start();
RUN

WebGL™ is a trademark of the Khronos Group Inc.

Next Page:taccglMaterial.blend - Set transparency values/set up blend animation
Previous Page: taccglMaterial.lightBgAmbDiff - Set background color, ambient and diffuse factors