css双圆环旋转效果

效果图如下:鼠标移上去加快旋转速度,rem做单位,两个圆环的图片可以随便找在此不上传了

代码如下:

 

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no">
    <title>旋转效果</title>
    <script>
        function fontAuto(){
            document.documentElement.style.fontSize = document.documentElement.clientWidth/19.2 + 'px';
        }
        fontAuto();
        window.onresize=function () {
            fontAuto();
        };
    </script>
    <style>
        *{margin:0 auto;}
        html,body{background:#09203e;width:100%;height:100%;}
        /*旋转球部分*/
        .circle_div{position:absolute;cursor:pointer;width:4.8rem;height:4.8rem;top:10%;left:50%;margin-left:-2.4rem;}
        .circle_div:hover .circle_rate{animation-timing-function: ease;animation-duration:3s;}
        .circle_rate{width:100%;height:100%;  position: absolute;top:0;left:0;z-index:1;  transition: all;  transform-origin: center;  animation-fill-mode: both;  animation-duration: 12s;  animation-iteration-count: infinite;  animation-timing-function: linear;  }
        .rotate-out{animation-name: rotate-out ;width:3.2rem;height:3.2rem;top:0.8rem;left:0.8rem;}
        .rotate-in{animation-name: rotate-in;}
        @keyframes rotate-out{
            from{transform: rotate(0deg);}
            to{transform: rotate(360deg);}
        }

        @-moz-keyframes rotate-out{
            from{transform: rotate(0deg);}
            to{transform: rotate(360deg);}
        }
        @-ms-keyframes rotate-out{
            from{transform: rotate(0deg);}
            to{transform: rotate(360deg);}
        }
        @-webkit-keyframes rotate-out{
            from{transform: rotate(0deg);}
            to{transform: rotate(360deg);}
        }
        @keyframes rotate-in{ from{transform: rotate(360deg);} to{transform: rotate(0deg);} }
        @-moz-keyframes rotate-in{ from{transform: rotate(360deg);} to{transform: rotate(0deg);} }
        @-ms-keyframes rotate-in{ from{transform: rotate(360deg);} to{transform: rotate(0deg);} }
        @-webkit-keyframes rotate-in{ from{transform: rotate(360deg);} to{transform: rotate(0deg);} }
    </style>
</head>
<body>
<div class="circle_div">
    <img class="circle_rate rotate-in" src="img/btn1-cir2.png"/>
    <img class="circle_rate rotate-out" src="img/btn1-cir1.png"/>
</div>
</body>
</html>

 

  • 1
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

辣姐什么鬼

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

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

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

打赏作者

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

抵扣说明:

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

余额充值