<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<style>
.heart{
background-image: url("http://panjiachen.github.io/warehouse/twitterLike/images/web_heart_animation.png");
background-position: left;
background-repeat: no-repeat;
width: 100px;
height: 100px;
}
.animation{
animation: position 1s steps(28);
}
@keyframes position {
to{
background-position: right;
}
}
</style>
</head>
<body>
<div class="heart animation"></div>
</body>
</html>
animation steps函数参考:https://blog.csdn.net/z1844306480/article/details/108467040