利用HTML和CSS3新特性实现太极图旋转

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>太极图</title>
    <style>
        .box{
            box-sizing: border-box;
            width: 400px;
            height: 400px;
            margin: 50px auto;
            border: 1px solid black;
            position: relative;

            border-radius: 50%;
            overflow: hidden;

            /*旋转动画1: 添加旋转方式*/
            /*transform-origin: center;*/
            /*transition: transform 1s;*/
            /*transform: rotate(90deg);*/

            /*旋转动画2: 添加持续动画方式*/
            animation: run 10ms linear infinite;
        }

        .box:hover{
            /*旋转动画1: 设置鼠标悬浮时旋转角度*/
            /*transform: rotate(360deg);*/

            /*旋转动画2: 设置鼠标悬浮时动画停止*/
            animation-play-state: paused;
        }

        /*旋转动画2: 设置动画工作方式*/
        @keyframes run{
				from{transform: rotate(0deg);}
				to{transform: rotate(360deg);}
        }

        .box .top{
            box-sizing: border-box;
            width: 100% ;
            height: 50%;
            background-color: black;

            display: flex;
            align-items: flex-end;
        }
        .box .top .top_one{
            box-sizing: border-box;
            width: 50%;
            height: 50%;
            background-color: white;
            border-top-left-radius: 100px;
            border-top-right-radius: 100px;
        }
        .box .bottom{
            box-sizing: border-box;
            width: 100% ;
            height: 50%;
            background-color: white;

            display: flex;
            flex-direction: row-reverse;
            align-items: flex-start;
        }

        .box .bottom .bottom_one{
            box-sizing: border-box;
            width: 50%;
            height: 50%;
            background-color: black;
            border-bottom-left-radius: 100px;
            border-bottom-right-radius: 100px;
        }

        .left_cir{
            position: absolute;
            top: 150px;
            left: 75px;
            width: 50px;
            height: 50px;
            background-color: black;
            border-radius: 50%;
        }
        .right_cir{
            position: absolute;
            top: 150px;
            right: 75px;
            width: 50px;
            height: 50px;
            background-color: white;
            border-radius: 50%;
        }
    </style>
</head>
<body>
    <div class="box">

        <div class="top">
            <div class="top_one"></div>
        </div>
        <div class="bottom">
            <div class="bottom_one"></div>
        </div>

        <div class="left_cir"></div>
        <div class="right_cir"></div>

    </div>

</body>
</html>

在这里插入图片描述

利用HTML和CSS3新特性实现太极图旋转

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值