animation(一):漂浮的白云

 漂浮的白云主要通过远景白云和近景白云来实现立体漂浮效果。远景和近景分别使用两张背景图片,通过改变其背景定位来实现白云移动效果,通过设置不同的动画持续时间来实现交错漂浮的效果


<!DOCTYPE html>

<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style>
.box{
position: relative;
height: 300px;
width: 500px;
}
.in1,.in2{
position: absolute;
height: 100%;
width: 100%;
background-size:cover;
-webkit-animation: move 100s infinite linear alternate;
animation: move 100s infinite linear alternate;
}
@-webkit-keyframes move{
100%{background-position: 500% 0;}
}
@keyframes move{
100%{background-position: 500% 0;}
}
.in1{
background-image: url('http://sandbox.runjs.cn/uploads/rs/26/ddzmgynp/cloud.png');

}
.in2{
background-image: url('http://sandbox.runjs.cn/uploads/rs/26/ddzmgynp/cloud1.png');
-webkit-animation-duration: 10s;
animation-duration: 10s;
}
</style>
</head>
<body>
<div class="box">
<div class="in1"></div>
<div class="in2"></div>
</div>
</body>
</html>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值