html动画实现an,利用Css3伪类加Animation绑定动画实现旋转的太极

Css-伪类_太极

原理:利用css的before和after这2个属性值来实现画出太极,然后定义动画,最后用animation绑定动画,实现效果。

Demo:

Css-伪类_太极

@keyframes xuanzhuan{

0%{

transform: rotate(0deg);

}

100%{

transform: rotate(360deg);

}

}

@-webkit-keyframes xuanzhuan{

0%{

transform: rotate(0deg);

}

100%{

transform: rotate(360deg);

}

}

#yin-yang {

width: 96px;

height: 48px;

background: #fff;

border-color: black;

border-style: solid;

border-width: 2px 2px 50px 2px;

border-radius: 100%;

position: relative;

transform: rotate(-90deg);

animation: xuanzhuan 3s linear 0s infinite;

-webkit-animation: xuanzhuan 3s linear 0s infinite;

}

#yin-yang:before {

content: "";

position: absolute;

top: 50%;

left: 0;

background: #eee;

border: 18px solid black;

border-radius: 100%;

width: 12px;

height: 12px;

}

#yin-yang:after {

content: "";

position: absolute;

top: 50%;

left: 50%;

background: black;

border: 18px solid #fff;

border-radius:100%;

width: 12px;

height: 12px;

}

@keyframes boxxz{

0%{

transform: rotate(0deg);

}

100%{

transform: rotate(360deg);

}

}

.box{width: 200px;height: 200px;border-radius: 100px;border: 3px solid slateblue;border-top:0;border-left: 0;border-bottom:0;animation: boxxz 2s linear 0s infinite;}

.box:after{content:"";width: 180px;height: 180px;background: seashell;}

效果图:

20180725090455593429.png

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值