图片:
百度网盘
<!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>Document</title>
<style>
.box {
position: relative;
width: 1920px;
height: 800px;
}
.bg1 {
position: absolute;
top: 0;
left: 0;
background: url(images/bg2.png) no-repeat;
width: 1920px;
height: 800px;
animation: move 50s linear infinite;
}
.bg2 {
position: absolute;
top: 200px;
left: 0;
background: url(images/bg1.png) no-repeat;
width: 1920px;
height: 800px;
animation: move 40s linear infinite;
}
.bear {
position: absolute;
top: 400px;
width: 200px;
height: 100px;
background: url(images/bear.png) no-repeat;
animation: bear 1s steps(8) infinite, bearmove 2s linear forwards;
z-index: 1;
}
@keyframes bear {
0% {
background-position: 0 0;
}
100% {
background-position: -1600px 0;
}
}
@keyframes bearmove {
0% {
left: 0;
}
100% {
left: 50%;
transform: translateX(-50%);
}
}
@keyframes move {
0% {
background-position: 0 0;
}
100% {
background-position: 100% 0;
}
}
</style>
</head>
<body>
<div class="box">
<div class="bg1"></div>
<div class="bg2">
</div>
<div class="bear"></div>
</div>
</body>
</html>