Canvas Library
 

opaqueShadow Library Method

Short Description: Control display of shadows on a solid transition

Signature: t.opaqueShadow ([enable])
Group: Light and Shadow
Class: transition Class
 

If enabled (enable=true or missing) then only the shadows on the element are drawn, not the element itself. The idea is that the user makes sure that the element itself is drawn using HTML+CSS, while taccgl™ draws just the shadows on top of that.

opaqueShadow and shadowOnly are very similar. With shadowOnly still a texture must be given. Although the texture does not show up itself, transparent pixels in the texture are relevant to define areaes where no shadows appear. In contrast opaqueShadow does not need a texture and makes the shadow appear on the complete element.

Note that in contrast to castShadow, which controlls the shadows casted by this transition on other transitions, opaqueShadow and shadowOnly control the shadows other elements or objects cast on this transition.

Using LightAmbDiff and lightBgAmbDiff the color of the shadow can be controlled.

The element is assuemed to be solid, having a non-transparent texture everywhere. Color and texture should not be set when using opaqueShadow. In fact currently opaqueShadow internally sets the color to solid black and then uses shadowOnly.

The first example below should show up nicely (although on slow GPUs shadows might be disabled completely and not show up). The remaining examples study shadows casted from the image on the text leaving out shadows on the body for demonstration purposes.

taccgl.a(document.body).opaqueShadow().showAfter().start();
taccgl.actor("testimg").to(500,1000,-1000).dur(7).start();
taccgl.actor("ex1").to(500,1000,-2000).dur(7).start();
RUN
taccgl.actor("testimg").to(500,1000,-1000).dur(7).start();
taccgl.actor("ex1").opaqueShadow().dur(7).start();
RUN
taccgl.actor("testimg").to(500,1000,-1000).dur(7).start();
taccgl.a("ex1").opaqueShadow().dur(7).start();
RUN
taccgl.actor("testimg").to(500,1000,-1000).dur(7).start();
taccgl.actor("ex1").opaqueShadow(false).dur(7).start();
RUN

The second example shows that opaqueShadow indeed just draws the shadow and nothing else. So the text does not show up only the shadow of the image on the text box. In the third example the text is displayed via HTML/CSS. While the image casts a shadow on it the shadow is drawn on top of the HTML/CSS text.

WebGL™ is a trademark of the Khronos Group Inc.

Next Page:transition.shadowOnly - Control display of shadows on transition
Previous Page: transition.specLight - Set specular light factor and shininess