css动画模拟充电效果

css动画模拟充电效果

动画效果

在这里插入图片描述

二代码实现

		 <div class="circle1">
        	<div class="cover"></div>
		 </div>
 		.circle1{
            width: 150px;
            height: 150px;
            border-radius: 50%;
            background-color: rgba(109, 151, 230,0.8);
            margin: 100px auto;
            border: 3px solid rgb(226, 212, 133);
            position: relative;
            overflow: hidden;
        }
        .cover{
            width: 100%;
            height: 100%;
            position: absolute;
            top: 0;
            left: 0;
            background-color: rosybrown;
            z-index: 1;
        }
        .cover::before{
            content: "";
            width: 230px;
            height: 230px;
            position: absolute;
            background-color: rgba(245, 243, 243, 0.904);
            border-radius: 40% 30%;
            left: -50%;
            animation: coverBefore 9s linear infinite;
        }
        .cover::after{
            content: "";
            width: 230px;
            height: 230px;
            position: absolute;
            background-color: rgba(245, 243, 243, 0.904);
            border-radius: 44% 40%;
            left: -50%;
            animation: coverAfter 9s linear infinite;
        }
        @keyframes coverBefore {
            0%{
                transform: rotate(0deg) ;
                bottom: 60%;
            }
            100%{
                transform: rotate(360deg);
                bottom: 105%;
            }
        }
        @keyframes coverAfter {
            0%{
                transform: rotate(30deg) ;
                bottom: 60%;
            }
            100%{
                transform: rotate(360deg);
                bottom: 105%;
            }
        }

总结

  • 通过::before和::after可以实现很多动画效果。
  • 使用时将伪类样式中content属性设置为“”
  • 使用定位父绝子相
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值