当前位置: 首页>>代码示例 >>用法及示例精选 >>正文


SVG FEMergeNode.in1属性用法及代码示例


SVG FEMergeNode.in1属性返回与FEMergeNode元素的in1组件相对应的SVGAnimatedString对象。

用法:

let in_prop = FEMergeNode.in1

返回值:此属性返回与FEMergeNode元素的in1组件相对应的SVGAnimatedString对象。

范例1:

HTML

<!DOCTYPE html> 
<html> 
  
<body> 
    <svg width="200" height="200"> 
        <filter id="feOffset" x="-40" y="-20" 
            width="100" height="200"> 
              
            <feOffset in="SourceGraphic" 
                dx="60" dy="60" /> 
  
            <feGaussianBlur stdDeviation="5" 
                result="blur2" /> 
  
            <feMerge> 
                <feMergeNode in="BackgroundImage" 
                    id="gfg" /> 
            </feMerge> 
        </filter> 
  
        <rect x="40" y="40" width="100" height="100"
            style="stroke:#000000; fill:red;  
                 filter:url(#feOffset);" /> 
  
        <rect x="40" y="40" width="100" height="100"
            style="stroke:#000000; fill:red;" /> 
  
        <script type="text/javascript"> 
            let mergeNode = document.getElementById("gfg"); 
            console.log(mergeNode.in1); 
              
            console.log("in1 value is:", 
                mergeNode.in1.baseVal); 
        </script> 
    </svg> 
</body> 
  
</html>

输出:



范例2:

HTML

<!DOCTYPE html> 
<html> 
  
<body> 
    <svg width="200" height="200"> 
        <filter id="feOffset" x="-40" y="-20"
            width="100" height="200"> 
              
            <feOffset in="FillPaint" dx="60" 
                dy="60" /> 
  
            <feGaussianBlur in="SourceGraphic" 
                stdDeviation="5" /> 
  
            <feMerge> 
                <feMergeNode in="BackgroundImage" 
                    id="gfg" /> 
            </feMerge> 
        </filter> 
  
        <rect x="40" y="40" width="100" height="100"
            style="stroke:#000000; fill:blue;  
                 filter:url(#feOffset);" /> 
  
        <rect x="40" y="40" width="100" height="100" 
            style="stroke:#000000; fill:red;" /> 
  
        <script type="text/javascript"> 
            let mergeNode = 
                document.getElementById("gfg"); 
            console.log(mergeNode.in1); 
              
            console.log("in1 value is:", 
                mergeNode.in1.baseVal) 
        </script> 
    </svg> 
</body> 
  
</html>

输出:

支持的浏览器:

  • 谷歌浏览器
  • Edge
  • Firefox
  • Safari
  • Opera
  • IE浏览器




相关用法


注:本文由纯净天空筛选整理自taran910大神的英文原创作品 SVG FEMergeNode.in1 Property。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。