css水波浪动画效果

为缩小gif大小,动画效果做了加速,效果如下:

<!DOCTYPE html>
<html>
<head>
<style>
*{padding:0;margin:0;}/*清除默认填充及边距*/

.water{position:relative;width:100vw;height:100vh;overflow:hidden;background:#cdfffc;}
.water:before,.water:after{content:"";position:absolute;left:50%;width:200vw;height:200vw;top:-158vw;margin-left:-100vw;background:linear-gradient(to right,rgba(1,174,255,1),rgba(11,5,255,1));border-radius:42%;animation:rotate 20s linear infinite;z-index:1;}
.water:after{border-radius:40%;background:linear-gradient(to right,rgba(11,5,255,0.5),rgba(1,174,255,0.5));animation:rotate 24s linear -10s infinite;z-index:2;}

@keyframes rotate {
50%{transform:rotate(180deg);}
100%{transform:rotate(360deg);}
}

.water .millia{position:relative;z-index:3;background:#fff;width:96vw;margin:1vh auto 0 auto;text-align:center;border-radius:1vh;}
</style>
</head>
<body>

<!--if--使用-->
<div class="water"></div>


<!--else--做背景图使用-->
<div class="water">
<div class="millia"><br><br><br>如<br>果<br>做<br>背<br>景<br>图<br>使<br>用<br><br><br><br></div>
</div>
</body>
</html>

 说明:

采用vw和vh单位可适配移动和pc,调整top的值可以改变高度

.water:before,.water:after设置width、height、border-radius、top、background等以改变效果

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值