|
The following example will show you how to interactively modify the 3D scene.
See
X3D Material node definition for an explanation of the different color attributes.
ambientIntensity ambientIntensity: 0 1 diffue color red: 0 1 green: 0 1 blue: 0 1 emissive color red: 0 1 green: 0 1 blue: 0 1 specular color red: 0 1 green: 0 1 blue: 0 1 shininess shininess: 0 1 transparency transparency : 0 1
For example, if the diffuse color should be set to red, the Material node is referenced by its id and the attribute diffuseColor is set to "1.0 0.0 0.0". The attribute value is always a string. var mat = document.getElementById("material"); mat.setAttribute("diffuseColor", "1.0 0.0 0.0");In the example, the RGB value is fetched from the slider. var mat = document.getElementById("material"); rgbstring = " "+ red + " " + green + " " + blue; mat.setAttribute("diffuseColor", rgbstring); |