XML technologies / SVG / Filters, transformations and gradients / Using and combining filters and lighting effectively / Lighting effects / Defining a spotlight

(Excerpt from “Das Einsteigerseminar SVG — Webgrafiken mit XML” by Helma Spona)

To create a spotlight, use the element <feSpotLight>. It has these attributes:

<filter id="FLicht03">
  <feDiffuseLighting in="SourceGraphic" diffuseConstant="1" surfaceScale="10" style="lighting-color:white">
    <feSpotLight x="0" y="0" z="25" pointsAtX="40" pointsAtY="40" pointsAtZ="0" specularExponent="0.01" limitingConeAngle="30"/>
  </feDiffuseLighting>
</filter>
<filter id="FLicht04">
  <feDiffuseLighting in="SourceGraphic" diffuseConstant="1" surfaceScale="10" style="lighting-color:white">
    <feSpotLight x="0" y="0" z="25" pointsAtX="40" pointsAtY="40" pointsAtZ="0" specularExponent="0.01"/>
  </feDiffuseLighting>
</filter>

The bottom two squares in the following graphic show the effects defined above. They differ only in the specification of the attribute limitingConeAngle (in FLicht03), which prevents light from appearing outside this angle.

Effects created with feDistantLight, fePointLight and feSpotLight

Figure: Effects created with feDistantLight, fePointLight and feSpotLight.

   

 

 

 

back to top