css3做太极图

使用 css3 制作炫酷的会转的太极图:

先做出基本外观:

<body>
    
    <div class="box"></div>

</body>

最外层样式:

 <style>
        .box{
            width: 400px;
            height: 400px;
            border: 1px solid #000;
            /* 最外层大盒子倒圆角边 */
            border-radius: 50%;
            /* 加上盒子阴影,方便查看 */
            box-shadow: 0 0 50px rgba(0,0,0,0.8);
            position: relative;
        }
        /* 使用伪类,做出左右黑白两块区域 */
        /* 黑色 */
        .box:before{
            content: '';
            display: block;
            width: 200px;
            height: 400px;
            position: absolute;
            top: 0;
            left: 0;
            background-color: #000;
            /* 倒圆角边 */
            border-top-left-radius:200px;
            border-bottom-left-radius:200px;
        }

        /* 白色 */
        .box:after{
            content: '';
            display: block;
            width: 200px;
            height: 400px;
            background-color: #fff;
            position: absolute;
            right: 0;
            top: 0;
            /* 倒圆角边 */
            border-top-right-radius:200px;
            border-bottom-right-radius:200px;
        }
    </style>

现在是这个样子:

image.png

 在 .box 盒子中加上两个小盒子,做出交汇的半圆:

<body>
    
    <div class="box">
        <div class="banyuan1"></div>
        <div class="banyuan2"></div>
    </div>

</body>

样式:

  /* 黑色半圆 */
        .banyuan1{
            width: 200px;
            height: 200px;
            background-color: #000;
            z-index: 2;
            position: absolute;
            top: 0;
            left: 100px;
            border-radius: 300px;
        }
        /* 白色半圆 */
        .banyuan2{
            width: 200px;
            height: 200px;
            background-color: #fff;
            z-index: 2;
            position: absolute;
            top: 200px;
            right: 100px;
            border-radius: 300px;
        }

大致这个样子:

image.png

 在使用伪类,做出半圆中的小圆:

.banyuan1:after{
            content: '';
            width:75px;
	        height:75px;
	        background-color:white;
	        border-radius:75px;
	        position:absolute;
	        top: 60px;
	        left: 55px;
	        z-index:3;
        }
        .banyuan2:after{
            content:"";
            width:75px;
            height:75px;
            background-color:black;
            border-radius:75px;
            position:absolute;
            bottom: 60px;
            right: 55px;
            z-index:3;
        }

样式做好了:

image.png

 

给外层盒子添加动画:

/*动画*/

animation: mymove 2s linear infinite;

给太极图做旋转效果,360度旋转:

 .box{
            width: 400px;
            height: 400px;
            border: 1px solid #000;
            /* 最外层大盒子倒圆角边 */
            border-radius: 50%;
            /* 加上盒子阴影,方便查看 */
            box-shadow: 0 0 50px rgba(0,0,0,0.8);
            position: relative;
            
            animation: xuanzhuan 2s linear infinite;
        }
        @keyframes xuanzhuan {
            from{
                transform: rotate(0deg);
            }
            to{
                transform: rotate(360deg);
            }
        }

查看效果:

旋转的太极图1.gif

 

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值