爱心案例
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
*{
margin: 0;
padding: 0;
}
.main{
position: relative;
margin:0 auto;
width: 300px;
height: 285px;
margin-top: 350px;
}
img{
width: 300px;
height: 285px;
position: absolute;
left: 0;
bottom: 0;
}
@keyframes run{
0%{
transform: scale(0);
opacity: 1;
}
100%{
transform: scale(3);
opacity: 0;
}
}
.box1{
animation:run 5s linear 1s infinite;
opacity: 0;
}
.box2{
animation:run 5s linear 2s infinite;
opacity: 0;
}
.box3{
animation:run 5s linear 3s infinite;
opacity: 0;
}
.box4{
animation:run 5s linear 4s infinite;
opacity: 0;
}
</style>
</head>
<body>
<div class="main">
<img class="box1" src="love (1).png" alt="">
<img class="box2" src="love (1).png" alt="">
<img class="box3" src="love (1).png" alt="">
<img class="box4" src="love (1).png" alt="">
</div>
</body>
</html>
僵尸案例
<!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>
*{
margin: 0;
padding: 0;
}
html,body{
height: 100%;
overflow: hidden;
background:#000;
}
.dead{
width: 200px;
height: 312px;
background:url("/day11/dead.png") no-repeat;
animation: dead 2s steps(10) infinite,run 10s linear infinite;
}
@keyframes dead{
0%{
background-position:0 0 ;
}
100%{
background-position:-2000px 0 ;
}
}
@keyframes run {
0%{
transform:translateX(100vw);
}
100%{
transform:translateX(-200px);
}
}
</style>
</head>
<body>
<div class="dead"></div>
</body>
</html>
表情包案例
<!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>
*{
margin: 0;
padding: 0;
}
.girl{
width: 241px;
height: 187px;
margin:0 auto;
background: url("/day11/2.jpg") no-repeat;
animation:girl 2s steps(6) infinite;
}
@keyframes girl{
0%{
background-position: 0 0;
}
0%{
background-position:-1446px 0;
}
}
</style>
</head>
<body>
<div class="girl"></div>
</body>
</html>
梦幻西游
<!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>
*{
margin: 0;
padding: 0;
}
body{
width: 100%;
height: 100vh;
}
.main{
width: 100%;
height: 100%;
background: url("/day11/bj.webp") center center no-repeat;
position: relative;
overflow: hidden;
}
.first{
width: 200px;
height: 180px;
background: url("/day11/wukong.png") no-repeat;
background-size: cover;
position: absolute;
top: 352px;
left: 350px;
animation:first 2s steps(8) infinite,run 10s linear infinite;
}
@keyframes first{
0%{
background-position:0 0 ;
}
100%{
background-position:-1600px 0 ;
}
}
.second{
width: 200px;
height: 180px;
background: url("/day11/bajie.png") no-repeat;
background-size: cover;
position: absolute;
top: 352px;
left: 550px;
animation:second 2s steps(8) infinite,run 10s linear infinite;
}
@keyframes second{
0%{
background-position:0 0 ;
}
100%{
background-position:-1600px 0 ;
}
}
.third{
width: 170px;
height: 240px;
background: url("/day11/tangseng.png") no-repeat;
background-size: cover;
position: absolute;
top: 320px;
left: 740px;
animation:third 2s steps(8) infinite,run 10s linear infinite;
}
@keyframes third{
0%{
background-position:0 0 ;
}
100%{
background-position:-1360px 0 ;
}
}
.last{
width: 210px;
height: 200px;
background: url("/day11/shaseng.png") no-repeat;
background-size: cover;
position: absolute;
top: 350px;
left: 940px;
animation:last 2s steps(8) infinite,run 10s linear infinite;
}
@keyframes last{
0%{
background-position:0 0 ;
}
100%{
background-position:-1680px 0 ;
}
}
@keyframes run {
0%{
transform:translateX(100vw);
}
100%{
transform:translateX(-1200px);
}
}
</style>
</head>
<body>
<div class="main">
<div class="first"></div>
<div class="second"></div>
<div class="third"></div>
<div class="last"></div>
</div>
</body>
</html>