<!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>
body {
width: 100%;
height: 100%;
background-color: #561;
}
.cat {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
margin: auto;
width: 40%;
height: 0;
padding-bottom: 35%;
margin: auto;
background-color: #FFF7EA;
border-radius: 100%;
box-shadow: inset rgba(0, 0, 0, 0.05) -4px -6px 0 4px, inset rgba(0, 0, 0, 0.05) -8px -10px 0 8px, rgba(0, 0, 0, 0.2) 4px 6px 0 2px, rgba(0, 0, 0, 0.1) 4px 10px 0 6px;
-webkit-animation: head-turn 7s ease-in-out alternate infinite;
animation: head-turn 7s ease-in-out alternate infinite;
}
.ear {
position: absolute;
top: -15%;
width: 45%;
height: 50%;
background: #FFF7EA;
z-index: -1;
}
.ear:before {
content: "";
position: absolute;
bottom: 22%;
width: 60%;
height: 60%;
background: #f4e0dc;
}
.ear:after {
content: "";
position: absolute;
bottom: 15%;
width: 60%;
height: 40%;
background: #FFF7EA;
border-radius: 100%;
}
.ear.left {
left: -5%;
border-radius: 100% 10%;
-webkit-transform: rotate(-70deg);
transform: rotate(-70deg);
box-shadow: inset #FFF7EA 6px -12px 0 6px, inset rgba(0, 0, 0, 0.05) -8px -4px 0 2px, inset rgba(0, 0, 0, 0.05) -4px 10px 0 4px;
}
.ear.left:before {
left: 18%;
border-radius: 100% 10%;
box-shadow: inset rgba(0, 0, 0, 0.05) 2px -10px 0 4px;
}
.ear.left:after {
left: 12%;
-webkit-transform: rotate(45deg);
transform: rotate(45deg);
}
.ear.right {
right: -5%;
border-radius: 10% 100%;
-webkit-transform: rotate(70deg);
transform: rotate(70deg);
box-shadow: inset rgba(0, 0, 0, 0.05) 4px 8px 0 2px, inset rgba(0, 0, 0, 0.05) 4px 14px 0 4px;
}
.ear.right:before {
right: 18%;
border-radius: 10% 100%;
box-shadow: inset rgba(0, 0, 0, 0.05) -2px 6px 0 4px;
}
.ear.right:after {
right: 12%;
-webkit-transform: rotate(-45deg);
transform: rotate(-45deg);
}
.eye {
position: absolute;
top: 20%;
width: 28%;
height: 40%;
background: black;
}
.eye:before {
content: "";
position: absolute;
top: 25%;
right: 5%;
width: 25%;
height: 20%;
background-color: #FFF7EA;
border-radius: 100%;
-webkit-animation: twitch 0.1s linear infinite alternate;
animation: twitch 0.1s linear infinite alternate;
}
.eye:after {
content: "";
position: absolute;
top: 45%;
right: 28%;
width: 10%;
height: 8%;
background-color: #FFF7EA;
border-radius: 100%;
-webkit-animation: twitch 0.12s linear alternate infinite;
animation: twitch 0.12s linear alternate infinite;
}
.eye.left {
left: 15%;
border-radius: 100% 100% 80% 100%;
box-shadow: inset #FFF7EA 6px 0 0 0px, inset #67523c 14px -2px 0 0, black -2px 1px 0 1px;
-webkit-transform: rotate(-5deg);
transform: rotate(-5deg);
}
.eye.left:before {
right: 8%;
}
.eye.left:after {
right: 30%;
}
.eye.right {
right: 15%;
border-radius: 100% 100% 100% 80%;
box-shadow: inset #FFF7EA -6px 0 0 0px, inset #67523c -14px -2px 0 0, black 2px 1px 0 1px;
-webkit-transform: rotate(5deg);
transform: rotate(5deg);
}
.eye.right:before {
left: 8%;
}
.eye.right:after {
left: 30%;
}
.lash {
position: absolute;
top: 2%;
width: 12%;
height: 16%;
border-radius: 100%;
}
.lash:after {
content: "";
position: absolute;
top: 30%;
width: 60%;
height: 80%;
border-radius: 100%;
}
.left .lash {
left: -2%;
box-shadow: black -4px 2px 0;
-webkit-transform: rotate(-50deg);
transform: rotate(-50deg);
}
.left .lash:after {
left: -115%;
box-shadow: black -3px 4px 0;
}
.right .lash {
right: -2%;
box-shadow: black 4px 2px 0;
-webkit-transform: rotate(50deg);
transform: rotate(50deg);
}
.right .lash:after {
right: -115%;
box-shadow: black 3px 4px 0;
-webkit-transform: rotate(-5deg);
transform: rotate(-5deg);
}
.shine {
position: absolute;
bottom: 15%;
width: 35%;
height: 15%;
background: #FFF7EA;
}
.left .shine {
left: 15%;
border-radius: 100% 20%;
}
.right .shine {
right: 15%;
border-radius: 20% 100%;
}
.nose {
position: absolute;
top: 60%;
right: 0;
left: 0;
margin: auto;
background: #cbb8a4;
width: 8%;
height: 6%;
border-radius: 100% 100% 100px 100px;
box-shadow: inset rgba(0, 0, 0, 0.05) -4px -2px 0 2px, rgba(0, 0, 0, 0.1) 2px 2px 0 0;
z-index: 2;
}
.mouth {
position: absolute;
right: 0;
bottom: 12%;
left: 0;
margin: auto;
width: 15%;
height: 15%;
background: #FF0066;
border-radius: 100%;
z-index: 1;
box-shadow: inset rgba(0, 0, 0, 0.6) 0 16px 0 0, inset rgba(0, 0, 0, 0.2) 0 20px 0 2px, inset rgba(0, 0, 0, 0.05) 0 20px 0 6px;
-webkit-animation: breathe-in 2s ease-out infinite;
animation: breathe-in 2s ease-out infinite;
}
.mouth:before,
.mouth:after {
content: "";
position: absolute;
top: -35%;
width: 75%;
height: 65%;
background: #FFF7EA;
border-radius: 100%;
-webkit-animation: breathe-out 2s ease-out infinite;
animation: breathe-out 2s ease-out infinite;
}
.mouth:before {
left: -22%;
box-shadow: rgba(0, 0, 0, 0.8) -1px 3px 0;
}
.mouth:after {
right: -22%;
box-shadow: rgba(0, 0, 0, 0.8) 1px 3px 0;
}
@-webkit-keyframes twitch {
to {
-webkit-transform: translate(2px, 2px);
transform: translate(2px, 2px);
}
}
@keyframes twitch {
to {
-webkit-transform: translate(2px, 2px);
transform: translate(2px, 2px);
}
}
@-webkit-keyframes head-turn {
0% {
-webkit-transform: rotate(0);
transform: rotate(0);
}
15% {
-webkit-transform: rotate(0);
transform: rotate(0);
}
25% {
-webkit-transform: rotate(4deg);
transform: rotate(4deg);
}
40% {
-webkit-transform: rotate(4deg);
transform: rotate(4deg);
}
50% {
-webkit-transform: rotate(0);
transform: rotate(0);
}
60% {
-webkit-transform: rotate(0);
transform: rotate(0);
}
70% {
-webkit-transform: rotate(-3deg);
transform: rotate(-3deg);
}
75% {
-webkit-transform: rotate(-2deg);
transform: rotate(-2deg);
}
85% {
-webkit-transform: rotate(-2deg);
transform: rotate(-2deg);
}
95% {
-webkit-transform: rotate(0);
transform: rotate(0);
}
}
@keyframes head-turn {
0% {
-webkit-transform: rotate(0);
transform: rotate(0);
}
15% {
-webkit-transform: rotate(0);
transform: rotate(0);
}
25% {
-webkit-transform: rotate(4deg);
transform: rotate(4deg);
}
40% {
-webkit-transform: rotate(4deg);
transform: rotate(4deg);
}
50% {
-webkit-transform: rotate(0);
transform: rotate(0);
}
60% {
-webkit-transform: rotate(0);
transform: rotate(0);
}
70% {
-webkit-transform: rotate(-3deg);
transform: rotate(-3deg);
}
75% {
-webkit-transform: rotate(-2deg);
transform: rotate(-2deg);
}
85% {
-webkit-transform: rotate(-2deg);
transform: rotate(-2deg);
}