shadowOnly Library Method
Short Description: Control display of shadows on transition
Signature: t.shadowOnly ([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, transparent pixels in the texture
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 color and texture of the element becomes almost irrelevant, since
only the shadow but not the element is drawn. The texture is however
relevant in so far as no shadow is drawn where the texture is transparent
while there is no or a transparent background color given. If on the other
hand a non-transparent color is given, then shadows are shown throughout the
animated element and the texture becomes completely irrelevant.
The first and second example below should show up nicely (although
on slow GPUs shadows might be disabled completely and not show up).
The second example needs far less texture space by using color instead
of paint. 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).shadowOnly().paint().showAfter().start(); taccgl.actor("testimg").to(500,1000,-1000).dur(7).start(); taccgl.actor("ex1",null,null,2).to(500,1000,-2000).dur(7).start(); | RUN |
taccgl.a(document.body).shadowOnly().color("black").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").shadowOnly().dur(7).start(); | RUN |
taccgl.actor("testimg").to(500,1000,-1000).dur(7).start(); taccgl.a("ex1").paint().shadowOnly().dur(7).start(); | RUN |
taccgl.actor("testimg").to(500,1000,-1000).dur(7).start(); taccgl.a("ex1").color("white").shadowOnly().dur(7).start(); | RUN |
taccgl.actor("testimg").to(500,1000,-1000).dur(7).start(); taccgl.actor("ex1").shadowOnly(false).dur(7).start(); | RUN |
The third example shows that shadowonly indeed just draws the shadow
and nothing else. So the text does not show up only the shadow
on the image on the text. In the forth example the text is
displayed via HTML/CSS. While the image casts a shadow on it, it
becomes slightly darker in displaying the shadow. In the last but one
example the text has a background color and so the shadow appears
solid. The last example shows disabeling shadows at all.
WebGL™ is a trademark of the Khronos Group Inc.
|