目录
一、效果展示
二、代码
<!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>
<style>
@keyframes test {
from {
background-position: 0px 91px;
}
to {
background-position: -474px 91px;
}
}
.box1 {
width: 70px;
height: 91px;
background-image: url("../src/img_exercise/animation.png");
animation-name: test;
animation-duration: 0.5s;
animation-iteration-count: infinite;
animation-timing-function: steps(6);
}
</style>
</head>
<body>
<div class="box1"></div>
</body>
</html>