svg以动画方式设置透明度

快乐打工仔 分类:实例代码

svg以动画方式设置透明度属于前端实例代码,有关更多实例代码大家可以查看

svg以动画方式设置透明度:

分享一段代码实例,它实现了以动画方式设置透明度的功能。

代码实例如下:

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="author" content="http://www.pipipi.net/" />
<title>前端教程网</title>
<style>
* {
  margin: 0px;
  padding: 0px;
}
svg {
  border: 1px solid blue;
  width: 400px;
  height: 200px;
  margin: 100px;
  overflow: visible;
}
</style>
</head>
<body>
<svg> 
  <rect
        x="10" y="10"
        width="100" height="100"
        fill="blue">
    <animate
             attributeType="CSS"
             attributeName="opacity"
             from="1" to="0"
             dur="5s"
             repeatCount="indefinite" />
  </rect>             
  </svg>
</body>
</html>

svg以动画方式设置透明度,这样的场景在实际项目中还是用的比较多的,关于svg以动画方式设置透明度就介绍到这了。

回复

我来回复
  • 暂无回复内容