css3蒲公英飘动效果_css3 云朵飘动效果动画_html/css_WEB-ITnose
时间: 2023-10-24 07:08:20 浏览: 96
您好,以下是CSS3蒲公英飘动效果和CSS3云朵飘动效果的代码:
CSS3蒲公英飘动效果:
HTML代码:
```
<div class="dandelion"></div>
```
CSS代码:
```
.dandelion {
position: absolute;
background-image: url("https://webitnose-images.oss-cn-beijing.aliyuncs.com/public/images/dandelion.png");
background-repeat: no-repeat;
background-size: contain;
width: 30px;
height: 30px;
animation: dandelion 8s linear infinite;
}
@keyframes dandelion {
0% {
transform: translate(0, 0) rotateZ(0deg);
}
100% {
transform: translate(500px, 800px) rotateZ(360deg);
opacity: 0;
}
}
```
CSS3云朵飘动效果:
HTML代码:
```
<div class="cloud"></div>
```
CSS代码:
```
.cloud {
position: absolute;
background-image: url("https://webitnose-images.oss-cn-beijing.aliyuncs.com/public/images/cloud.png");
background-repeat: no-repeat;
background-size: contain;
width: 100px;
height: 50px;
animation: cloud 20s linear infinite;
}
@keyframes cloud {
0% {
transform: translate(0, 0);
}
100% {
transform: translate(600px, 0);
}
}
```
以上是简单的CSS3动画效果示例。希望能对您有所帮助。
阅读全文