限制錐角

Baseline 已廣泛支援

此特性已相當成熟,可在許多裝置和瀏覽器版本上使用。自 ⁨2015 年 7 月⁩以來,各瀏覽器均已提供此特性。

limitingConeAngle 屬性表示聚光燈軸(即光源到其指向點的軸)與聚光燈圓錐體之間的角度(以度為單位)。因此,它定義了一個限制區域,該區域限制了光線的投射範圍。圓錐體外部不會投射光線。

你可以將此屬性與以下 SVG 元素一起使用

示例

html
<svg viewBox="0 0 480 200" xmlns="http://www.w3.org/2000/svg">
  <filter id="spotLight1" x="0" y="0" width="100%" height="100%">
    <feDiffuseLighting diffuseConstant="2">
      <feSpotLight
        x="10"
        y="10"
        z="50"
        pointsAtX="100"
        pointsAtY="100"
        limitingConeAngle="10" />
    </feDiffuseLighting>
  </filter>
  <filter id="spotLight2" x="0" y="0" width="100%" height="100%">
    <feDiffuseLighting diffuseConstant="2">
      <feSpotLight
        x="10"
        y="10"
        z="50"
        pointsAtX="100"
        pointsAtY="100"
        limitingConeAngle="40" />
    </feDiffuseLighting>
  </filter>

  <rect x="0" y="0" width="200" height="200" filter="url(#spotLight1)" />
  <rect x="220" y="0" width="200" height="200" filter="url(#spotLight2)" />
</svg>

用法說明

<number>
預設值 0
可動畫的

規範

規範
濾鏡效果模組第 1 級
# element-attrdef-fespotlight-limitingconeangle

瀏覽器相容性