<feSpotLight>

<feSpotLight> SVG 濾鏡基本型別定義了一個光源,可用於建立聚光燈效果。它用於照明濾鏡基本型別中:<feDiffuseLighting><feSpecularLighting>

使用上下文

類別光源元素
允許內容以下元素的任意數量,以任何順序
<animate>, <set>

屬性

DOM 介面

此元素實現 SVGFESpotLightElement 介面。

例子

HTML

html
<svg
  width="200"
  height="200"
  xmlns="http://www.w3.org/2000/svg"
  xmlns:xlink="http://www.w3.org/1999/xlink">
  <defs>
    <filter id="spotlight">
      <feSpecularLighting
        result="spotlight"
        specularConstant="1.5"
        specularExponent="4"
        lighting-color="#FFF">
        <feSpotLight x="600" y="600" z="400" limitingConeAngle="5.5" />
      </feSpecularLighting>
      <feComposite
        in="SourceGraphic"
        in2="spotlight"
        operator="out"
        k1="0"
        k2="1"
        k3="1"
        k4="0" />
    </filter>
  </defs>

  <image
    href="mdn_logo_only_color.png"
    x="10%"
    y="10%"
    width="80%"
    height="80%"
    style="filter:url(#spotlight);" />
</svg>

結果

規範

規範
濾鏡效果模組 1 級
# feSpotLightElement

瀏覽器相容性

BCD 表格僅在瀏覽器中載入

另請參閱