请观赏
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>小球沿矩形运动</title>
<style>
.small{
width: 10px;
height: 10px;
border: 1px solid;
border-radius: 50px;
position: absolute;
top: 100px;
left: 100px;
animation: mat 30s infinite;
}
.big{
width: 300px;
height: 300px;
border: 1px solid;
position: absolute;
top: 100px;
left: 100px;
}
@keyframes mat{
0%{
position: absolute;
left: 100px;
top: 100px;
}
25%{
position: absolute;
left: 390px;
top: 100px;
}
50%{
position: absolute;
left: 390px;
top: 390px;
}
75%{
position: absolute;
left: 100px;
top: 390px;
}
100%{
position: absolute;
left: 100px;
top: 100px;
}
}
</style>
</head>
<body>
<div class="small"></div>
<div class="big">
</div>
</body>
</html>
<script>
</script>
请观赏2
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>纯css3动画实现轨道旋转效果</title>
<style>
body {
background-color: blueviolet;
}
.circle1 {
margin-top:100px;
width: 100px;
height: 100px;
border: 1px solid;
border-radius: 100px;
position: absolute;
z-index: 2;
left: 140px;
z-index: 2;
animation: myfirst1 5s linear infinite;
}
.circle2 {
width: 10px;
height: 10px;
border: 1px solid #ddd;
border-radius: 100px;
left: 45px;
top: 5px;
position: absolute;
z-index: 2;
background-color: #ddd;
box-shadow: 0px 0px 5px #fff;
}
@keyframes myfirst1 {
0%{
transform: rotate(0deg);
}
50%{
transform: rotate(180deg);
}
100%{
transform: rotate(360deg);
}
}
</style>
</head>
<body>
<div class="circle1">
<div class="circle2"></div>
</div>
</body>
</html>