<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>奔跑的小熊</title>
</head>
<style>
.box1 {
z-index: 2;
position: absolute;
left: 0;
bottom: 0%;
height: 336px;
width: 100%;
background: url(media/bg1.png)no-repeat;
animation: bg 30s linear infinite;
}
.box2 {
position: absolute;
left: 0;
bottom: 0%;
height: 569px;
width: 100%;
background: url(media/bg2.png)no-repeat;
opacity: .1;
animation: bg 30s linear infinite;
}
.box3 {
z-index: 1;
position: absolute;
left: 0;
bottom: 0%;
height: 384px;
width: 100%;
background: url(media/bg3.png)no-repeat;
opacity: .5;
animation: bg 30s linear infinite;
}
.bear {
z-index: 3;
position: absolute;
left: 0;
bottom: 0%;
width: 200px;
height: 100px;
background: url(media/bear.png)no-repeat;
animation: bear 1s steps(8) infinite, move 3s forwards;
}
@keyframes bear {
0% {
background-position: 0 0;
}
100% {
background-position: -1600px 0;
}
}
@keyframes move {
0% {
left: 0;
}
100% {
left: 50%;
margin-left: -100px;
}
}
@keyframes bg {
0% {
background-position: 0 0;
}
100% {
background-position: -1200px 0;
}
}
</style>
<body>
<div class="box1"></div>
<div class="box2"></div>
<div class="box3"></div>
<div class="bear"></div>
</body>
</html>