Canvas Library
 

castShadow Library Method

Short Description: Control casting of shadows on other transitions

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

By default or if explicitly enabled (enable=true or missing) then taccgl™ automatically calculates shadows casted from this transition on other transitions. In rare cases it is useful to disable castShadow. If disabled this transition will not cast any shadows. So from the perspective of the shadow drawing even if the drawn element or object is between the light source and another element or object, no shadow will appear on the other element or object.

castShadow does not effect shadows drawn on the animated element or object itself.

Using castShadow is sometimes useful, if the shadow is drawn by some other means, e.g. CSS. Please compare the second and third example below and watch the shadow of the main text box. As long as the examples are not running the main text box has a shadow created with CSS. When you start the second example (that does not use castShadow) the shadow becomes darker, because taccgl™ adds its own shadow in addition to the CSS shadow. Using castShadow this effect is corrected in the third example.

taccgl.a(document.body).shadowOnly().color("black").showAfter().start();
taccgl.actor("testimg").to(500,1000,-1000).dur(7).castShadow(false).start();
taccgl.actor("ex1").to(500,1000,-2000).dur(7).start();
RUN
taccgl.a("Middle").shadowOnly().color("black").showAfter().start();
taccgl.a("MenuBar").shadowOnly().color("black").showAfter().start();
taccgl.a(document.body).blend(0,0).color("#777777").shadowOnly().posZ(400).resizeZ().showAfter().start();
taccgl.actor("testimg").to(500,1000,-1000).dur(7).start();
RUN
taccgl.a("Middle").shadowOnly().color("black").showAfter().castShadow(false).start();
taccgl.a("MenuBar").shadowOnly().color("black").showAfter().castShadow(false).start();
taccgl.a(document.body).blend(0,0).color("#777777").shadowOnly().posZ(400).resizeZ().showAfter().start();
taccgl.actor("testimg").to(500,1000,-1000).dur(7).start();
RUN
Next Page:transition.posZ - Move in Eye Direction
Previous Page: transition.shadowOnly - Control display of shadows on transition