如何在一个圆里绕着转
请问怎么才能让一个物体在圆里面绕着圆转?
请问怎么才能让一个物体在圆里面绕着圆转?
2016-12-19
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>旋转的小球</title>
<style type="text/css">
.box {
margin:100px auto;
box-sizing: border-box;
background:red;
height: 60px; width: 60px;
border-radius: 50%;
/*box-shadow:0 -20px 0 36px green; */
box-shadow:inset 0 -20px 0 26px yellow ;
animation: rotate 1s infinite linear;
}
@keyframes rotate{
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
</style>
</head>
<body>
<div></div>
</body>
</html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<style>
.box{
width:400px;
height:400px;
border:1px solid #000;
border-radius:100%;
margin:50px auto;
position:relative;
}
.path{
width:300px;
height:300px;
border:1px dashed #ccc;
border-radius:100%;
position:absolute;
left:50px;
top:50px;
}
.ball{
width:100px;
height:100px;
background-color:rgba(255,0,0,.8);
border-radius:100%;
position:absolute;
left:50px;
top:50px;
animation:rotate 3s linear infinite;
}
@keyframes rotate{
from{
transform-origin:150px 150px;
transform:rotate(0deg);
}
to{
transform-origin:150px 150px;
transform:rotate(360deg);
}
}
</style>
</head>
<body>
<div class="box">
<div class="path"></div>
<div class="ball"></div>
</div>
</body>
</html>
举报