XML technologies / SVG / Filters, transformations and gradients / Using and combining filters and lighting effectively / Lighting effects / Defining distant light sources
(Excerpt from “Das Einsteigerseminar SVG — Webgrafiken mit XML” by Helma Spona)
The element <feDistantLight> defines distant light sources. It has these attributes:
azimuthsets the light source’s angle in the XY coordinate system. The default is 0.elevationsets the light source’s angle in the YZ coordinate system.zis the axis determining the light source’s height.
For a rectangle, such a light source simply brightens the filtered SVG object uniformly. Irregular objects instead show lighting and shadows. Brightness depends on both attributes and the parent tag’s settings.
<filter id="FLicht01">
<feDiffuseLighting in="SourceGraphic" diffuseConstant="1" surfaceScale="10" style="lighting-color:white">
<feDistantLight azimuth="0" elevation="30" />
</feDiffuseLighting>
</filter>
Note:
The example uses the tag <feDiffuseLighting> for lighting. Several attributes are required to make its effect visible; their meanings and purposes are explained shortly.
Applying the preceding filter with
<circle cx="50" cy="50" r="20" style="fill:red;filter:url(#FLicht01)" />to a simple red-filled circle (gray in the figure) produces this output.
Figure: Effects of the feDistantLight filter.
Copyright © verlag moderne industrie GmbH 2001
You may print the online version for your private use.
Otherwise, this chapter from “Das Einsteigerseminar SVG — Webgrafiken mit XML” is subject to the same conditions as the bound edition. The work, including all its parts, is protected by copyright. All rights reserved, including reproduction, translation, microfilming, and storage and processing in electronic systems.
verlag moderne industrie GmbH, Justus-von-Liebig-Straße 1, D-86899 Landsberg/Lech, fon ++49 (0) 81 91 / 125 – 0, leserservice(at)mi-verlag.de
back to top