css3動畫製作太極圖
阿新 • • 發佈:2019-02-13
css3:animation製作太極圖(勻速逆方向旋轉)【轉載】:
我們先來看下效果圖截圖:
製作時主要用到了css3的animation屬性
html:
<div class="taiji">
<div class="a">
<div class="inner"></div>
</div>
<div class="b">
<div class="inner"></div>
</div>
</div>
css:
body{ margin:0; padding:0; overflow:hidden; background:#999}
.taiji {
margin:50px 50px 0;
height:200px;
width:200px;
animation:run-inner2 2s infinite linear;
}
@keyframes run-inner2 {
0% {
transform:rotate(0deg)
}
25% {
transform:rotate(-90deg)
}
50% {
transform:rotate(-180deg)
}
75% {
transform:rotate(-270deg)
}
100% {
transform:rotate(-360deg)
}
}
.a {
width:200px;
height:100px;
border:1px solid #fff;
border-bottom:0px;
border-radius:100px 100px 0 0;
background:#fff;
position:relative;
}
.a:after {
content:"";
background:#fff;
width:15px;
height:15px;
border-radius:50%;
position:absolute;
top:72px;
left:147px;
}
.a .inner {
width:100px;
height:50px;
position:absolute;
bottom:0;
right:0;
background:#000;
border-radius:50px 50px 0 0;
}
.b {
width:201px;
height:101px;
border:1px solid #000;
border-top:0px;
border-radius:0 0 100px 100px;
background:#000;
position:relative;
}
.b:after {
content:"";
background:#000;
width:15px;
height:15px;
border-radius:50%;
position:absolute;
bottom:72px;
right:147px;
}
.b .inner {
width:100px;
height:50px;
position:absolute;
top:0;
left:0;
background:#fff;
border-radius:0 0 50px 50px;
}
另外請自行新增:jquery-1.11.1.min.js