Pacman
Source
<style>
#t {
width: 500px;
height: 500px;
background: #000;
position: relative;
}
#extBorder {
position: absolute;
border: 10px double #5858FF;
top: 15px;
left: 15px;
right: 15px;
bottom: 15px;
}
#intBorder {
position: absolute;
border: 10px double #5858FF;
top: 130px;
left: 130px;
right: 130px;
bottom: 130px;
}
#pacman {
animation: movePac 5s linear infinite;
-moz-animation: movePac 5s linear infinite;
-webkit-animation: movePac 5s linear infinite;
-o-animation: movePac 5s linear infinite;
position: absolute;
top: 50px;
left: 50px;
width: 60px;
height: 60px;
background: #ffff58;
border-radius: 60px;
z-index: 100;
}
#mouth {
animation: mouthPac 0.6s linear infinite;
-moz-animation: mouthPac 0.6s linear infinite;
-webkit-animation: mouthPac 0.6s linear infinite;
-o-animation: mouthPac 0.6s linear infinite;
position: absolute;
width: 0px;
height: 0px;
border-color: transparent #000 transparent transparent;
top: 17px;
left: 30px;
border-style: solid;
border-width: 15px 30px 15px 0;
}
.ball {
position: absolute;
background: #FFFFAB;
width: 15px;
height: 15px;
}
#b1 {
animation: b1 5s linear infinite;
-moz-animation: b1 5s linear infinite;
-webkit-animation: b1 5s linear infinite;
-o-animation: b1 5s linear infinite;
top: 70px;
right: 70px;
}
#b2 {
animation: b2 5s linear infinite;
-moz-animation: b2 5s linear infinite;
-webkit-animation: b2 5s linear infinite;
-o-animation: b2 5s linear infinite;
bottom: 70px;
right: 70px;
}
#b3 {
animation: b3 5s linear infinite;
-moz-animation: b3 5s linear infinite;
-webkit-animation: b3 5s linear infinite;
-o-animation: b3 5s linear infinite;
bottom: 70px;
left: 70px;
}
@keyframes movePac {
25% {top:50px;left:400px;transform: rotate(0deg);}
26% {top:50px;left:400px;transform: rotate(90deg);}
50% {top:400px;left:400px;transform: rotate(90deg);}
51% {top:400px;left:400px;transform: rotate(180deg);}
75% {top:400px;left:50px;transform: rotate(180deg);}
76% {top:400px;left:50px;transform: rotate(270deg);}
99% {top:50px;left:50px;transform: rotate(270deg);}
100% {top:50px;left:50px;transform: rotate(360deg);}
}
@keyframes mouthPac {
100% {top:30px;left:30px;border-style: solid;border-width: 2px 30px 2px 0;}
}
@keyframes b1 {
25% {background: #FFFFAB;}
26% {background: #000;}
100% {background: #000;}
}
@keyframes b2 {
50% {background: #FFFFAB;}
51% {background: #000;}
100% {background: #000;}
}
@keyframes b3 {
75% {background: #FFFFAB;}
76% {background: #000;}
100% {background: #000;}
}
/*moz*/
@-moz-keyframes movePac {
25% {top:50px;left:400px;transform: rotate(0deg);}
26% {top:50px;left:400px;transform: rotate(90deg);}
50% {top:400px;left:400px;transform: rotate(90deg);}
51% {top:400px;left:400px;transform: rotate(180deg);}
75% {top:400px;left:50px;transform: rotate(180deg);}
76% {top:400px;left:50px;transform: rotate(270deg);}
99% {top:50px;left:50px;transform: rotate(270deg);}
100% {top:50px;left:50px;transform: rotate(360deg);}
}
@-moz-keyframes mouthPac {
100% {top:30px;left:30px;border-style: solid;border-width: 2px 30px 2px 0;}
}
@-moz-keyframes b1 {
25% {background: #FFFFAB;}
26% {background: #000;}
100% {background: #000;}
}
@-moz-keyframes b2 {
50% {background: #FFFFAB;}
51% {background: #000;}
100% {background: #000;}
}
@-moz-keyframes b3 {
75% {background: #FFFFAB;}
76% {background: #000;}
100% {background: #000;}
}
/*webkit*/
@-webkit-keyframes movePac {
25% {top:50px;left:400px;-webkit-transform: rotate(0deg);}
26% {top:50px;left:400px;-webkit-transform: rotate(90deg);}
50% {top:400px;left:400px;-webkit-transform: rotate(90deg);}
51% {top:400px;left:400px;-webkit-transform: rotate(180deg);}
75% {top:400px;left:50px;-webkit-transform: rotate(180deg);}
76% {top:400px;left:50px;-webkit-transform: rotate(270deg);}
99% {top:50px;left:50px;-webkit-transform: rotate(270deg);}
100% {top:50px;left:50px;-webkit-transform: rotate(360deg);}
}
@-webkit-keyframes mouthPac {
100% {top:30px;left:30px;border-style: solid;border-width: 2px 30px 2px 0;}
}
@-webkit-keyframes b1 {
25% {background: #FFFFAB;}
26% {background: #000;}
100% {background: #000;}
}
@-webkit-keyframes b2 {
50% {background: #FFFFAB;}
51% {background: #000;}
100% {background: #000;}
}
@-webkit-keyframes b3 {
75% {background: #FFFFAB;}
76% {background: #000;}
100% {background: #000;}
}
/*o*/
@-o-keyframes movePac {
25% {top:50px;left:400px;transform: rotate(0deg);}
26% {top:50px;left:400px;transform: rotate(90deg);}
50% {top:400px;left:400px;transform: rotate(90deg);}
51% {top:400px;left:400px;transform: rotate(180deg);}
75% {top:400px;left:50px;transform: rotate(180deg);}
76% {top:400px;left:50px;transform: rotate(270deg);}
99% {top:50px;left:50px;transform: rotate(270deg);}
100% {top:50px;left:50px;transform: rotate(360deg);}
}
@-o-keyframes mouthPac {
100% {top:30px;left:30px;border-style: solid;border-width: 2px 30px 2px 0;}
}
@-o-keyframes b1 {
25% {background: #FFFFAB;}
26% {background: #000;}
100% {background: #000;}
}
@-o-keyframes b2 {
50% {background: #FFFFAB;}
51% {background: #000;}
100% {background: #000;}
}
@-o-keyframes b3 {
75% {background: #FFFFAB;}
76% {background: #000;}
100% {background: #000;}
}
</style>
<div id="t">
<div id="extBorder"></div>
<div id="intBorder"></div>
<div id="pacman">
<div id="mouth"></div>
</div>
<div id='b1' class='ball'></div>
<div id='b2' class='ball'></div>
<div id='b3' class='ball'></div>
</div>