<!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>CSS3 乒乓球比赛加载动画</title>
<style>
html {
background-color: #24f2b4;
}
.container {
position: absolute;
width: 200px;
height: 100px;
margin: auto;
top: 0;
bottom: 0;
left: 0;
right: 0;
/* border-top: #F20570 solid 2px; */
/* border-bottom: #F20570 solid 2px; */
}
.loading {
position: absolute;
font-family: sans-serif;
font-weight: 400;
color: #f20570;
width: 55px;
height: 10px;
margin: auto;
left: 0;
right: 0;
top: 0;
bottom: 0;
-webkit-animation: flash 0.75s infinite alternate linear;
animation: flash 0.75s infinite alternate linear;
}
.paddle {
position: absolute;
display: inline-block;
background-color: #f20570;
margin: auto;
top: auto;
bottom: 0;
left: 0;
width: 6px;
height: 40px;
border-radius: 10px;
-webkit-box-shadow: 0px 0px 8px #f20570;
-webkit-animation: slide 1.2s 0.2s infinite alternate linear;
animation: slide 0.8s 0.2s infinite alternate linear;
}
.paddle#right {
top: 0;
bottom: auto;
left: auto;
right: 0;
-webkit-animation: slide2 1s infinite alternate linear;
animation: slide2 1s infinite alternate linear;
}
.ball {
position: absolute;
background-color: #f20570;
width: 10px;
height: 10px;
margin: 8px;
bottom: 10px;
left: 0;
border-radius: 50%;
-webkit-animation: pong 1.5s infinite alternate linear;
animation: pong 1.5s infinite linear;
}
@-webkit-keyframes slide {
0% {
bottom: 40px;
}
45% {
bottom: 0px;
}
67% {
bottom: 60px;
}
100% {
bottom: 40px;
}
}
@-keyframes slide {
0% {
bottom: 40px;
}
45% {
bottom: 0px;
}
67% {
bottom: 60px;
}
100% {
bottom: 40px;
}
}
@-webkit-keyframes slide2 {
0% {
top: 20px;
}
45% {
top: 0px;
}
67% {
top: 60px;
}
100% {
top: 20px;
}
}
@-keyframes slide2 {
0% {
top: 20px;
}
45% {
top: 0px;
}
67% {
top: 60px;
}
100% {
top: 20px;
}
}
@-webkit-keyframes pong {
0% {
bottom: 40px;
left: 0;
}
30% {
bottom: -10px;
left: 150px;
}
45% {
bottom: 40px;
left: 170px;
}
70% {
bottom: 80px;
left: 80px;
}
100% {
bottom: 40px;
left: 0;
}
}
@-keyframes pong {
0% {
bottom: 20px;
left: 0;
}
30% {
bottom: -10px;
left: 150px;
}
45% {
bottom: 40px;
left: 170px;
}
70% {
bottom: 80px;
left: 80px;
}
100% {
bottom: 20px;
left: 0;
}
}
@-webkit-keyframes flash {
0% {
opacity: 0.2;
}
100% {
opacity: 1;
}
}
</style>
</head>
<body>
<div class="container">
<div class="paddle" id="left"></div>
<div class="paddle" id="right"></div>
<div class="ball"></div>
<div class="loading">Loading</div>
</div>
</body>
</html>