纯Html CSS实现云雨动画效果

        纯HTML和CSS实现云雨动画效果,动态效果由CSS实现,主要有两个动画实现

        代码下面自取🖖

🎈效果如下

 HTML代码如下

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Cloud & Rain Animation</title>
    <link rel="stylesheet" href="style.css">
</head>
<body>
    <div class="container">
        <div class="cloud"></div>
        <div class="rain">
            <span style="--i:11"></span>
            <span style="--i:12"></span>
            <span style="--i:10"></span>
            <span style="--i:14"></span>
            <span style="--i:18"></span>
            <span style="--i:16"></span>
            <span style="--i:19"></span>
            <span style="--i:20"></span>
            <span style="--i:19"></span>
            <span style="--i:10"></span>
            <span style="--i:16"></span>
            <span style="--i:14"></span>
            <span style="--i:18"></span>
            <span style="--i:11"></span>
            <span style="--i:13"></span>
            <span style="--i:15"></span>
            <span style="--i:12"></span>
            <span style="--i:11"></span>
            <span style="--i:17"></span>
            <span style="--i:13"></span>
        </div>
    </div>
</body>
</html>

  CSS代码如下

*{
    margin:0;
    padding: 0;
    box-sizing: border-box;
}

body{
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: #181c1f;
}

.container{
    position: relative;
    height: 400px;
    border-bottom: 2px solid #fff;
}

.cloud{
    position: relative;
    top: 50px;
    width: 320px;
    height: 100px;
    background: #fff;
    border-radius: 100px;
}

.cloud::before{
    content: '';
    position: absolute;
    top: -50px;
    left: 40px;
    width:110px;
    height: 110px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 90px 0 0 30px #fff;
}
.rain{
    position: relative;
    display: flex;
    z-index: 1;
    padding: 0 20px;
}
.rain span{
    position: relative;
    bottom: 10px;
    width: 10px;
    height: 10px;
    background-color: rgb(164, 236, 252);
    margin: 0 2px;
    border-radius: 50%;
    animation: animate 5s linear infinite;
    animation-duration: calc(15s / var(--i));
    transform-origin: bottom;
}

@keyframes animate{
    0%{
        transform: translateY(0) scale(1);
    }
    70%{
        transform: translateY(300px) scale(1);
    }
    100%{
        transform: translateY(300px) scale(0);
    }
}
  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

爱躺平的威威

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值