Movatterモバイル変換


[0]ホーム

URL:


  1. Web
  2. SVG
  3. Reference
  4. Attributes
  5. diffuseConstant

diffuseConstant

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since ⁨January 2020⁩.

ThediffuseConstant attribute represents the kd value in thePhong lighting model. In SVG, this can be any non-negative number.

It's used to determine the final RGB value of a given pixel. The brighter the lighting-color, the smaller this number should be.

You can use this attribute with the following SVG elements:

Example

html,body,svg {  height: 100%;}
html
<svg viewBox="0 0 420 200" xmlns="http://www.w3.org/2000/svg">  <filter x="0" y="0" width="100%" height="100%">    <feDiffuseLighting in="SourceGraphic" diffuseConstant="1">      <fePointLight x="60" y="60" z="20" />    </feDiffuseLighting>  </filter>  <filter x="0" y="0" width="100%" height="100%">    <feDiffuseLighting in="SourceGraphic" diffuseConstant="2">      <fePointLight x="60" y="60" z="20" />    </feDiffuseLighting>  </filter>  <rect x="0" y="0" width="200" height="200" filter="url(#diffuseLighting1)" />  <rect    x="220"    y="0"    width="200"    height="200"    filter="url(#diffuseLighting2)" /></svg>

Usage notes

Value<number>
Default value1
AnimatableYes

Specifications

Specification
Filter Effects Module Level 1
# element-attrdef-fediffuselighting-diffuseconstant

Browser compatibility

See also

Help improve MDN

Learn how to contribute

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2025 Movatter.jp