【发布时间】:2014-06-11 01:51:23
【问题描述】:
html
<div class="camera">
<div class="dreid">
<div class="planet1"></div>
<div class="planet2"></div>
</div>
</div>
css
.camera {
width: 300px;
height: 300px;
border: 1px solid black;
-webkit-perspective: 800;
-webkit-perspective-origin: 50% 700px;
}
.dreid {
width:220px;
height:220px;
border-radius: 50%;
border: 1px solid black;
margin: 60px auto;
-webkit-transform: rotateX(45deg);
-webkit-animation-name: spin;
-webkit-animation-duration: 10s;
-webkit-animation-iteration-count: infinite;
-webkit-animation-timing-function: linear;
}
@-webkit-keyframes spin {
from {
-webkit-transform:rotate(0deg);
}
to {
-webkit-transform:rotate(360deg);
}
}
.planet1 {
position:absolute;
top:0;
left:0;
width:50px;
height:50px;
background:red;
border-radius:50%;
}
.planet2 {
position: absolute;
top:170px;
left:170px;
width:50px;
height:50px;
background:red;
border-radius:50%;
}
如您所见,我尝试在旋转之前将透视应用于圆(有点像在行星系统中)。问题是,动画位似乎覆盖了我用 -perspective 和 -transform:rotate 设置的变换位。有没有可能用纯css完成?
编辑:JSFiddle
【问题讨论】:
标签: html css transform css-animations