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


SVG RectElement.ry属性用法及代码示例


SVG RectElement.ry属性用于返回与给定rect属性对应的SVGAnimatedLength对象角度元件。

用法:

RectElement.ry

返回值:此属性返回一个可以使用的SVGAnimatedLength对象获取矩形元素的“ry”值和其他属性。

范例1:

HTML

<!DOCTYPE html> 
<html> 
  
<body> 
    <h1 style="color:green"> 
        GeeksforGeeks 
    </h1> 
      
    <h3>SVG RectElement.ry property</h3> 
      
    <svg width="300" height="300" 
        xmlns="http://www.w3.org/2000/svg"> 
          
        <rect width="100" height='190' 
            fill="green" id="gfg" rx=10 ry=30 /> 
              
        <script> 
            var g = document.getElementById("gfg"); 
            console.log(g.ry) 
        </script> 
    </svg> 
</body> 
  
</html>

输出:



范例2:

HTML

<!DOCTYPE html> 
<html> 
  
<body> 
    <h1 style="color:green"> 
        GeeksforGeeks 
    </h1> 
      
    <h3>SVG RectElement.ry property</h3> 
      
    <svg width="300" height="300" 
        xmlns="http://www.w3.org/2000/svg"> 
          
        <rect width="100" height='190' 
            fill="green" id="gfg" rx=10% ry=35% /> 
              
        <script> 
            var g = document.getElementById("gfg"); 
            console.log(g.ry) 
        </script> 
    </svg> 
</body> 
  
</html>

输出:




相关用法


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