【发布时间】:2021-04-07 11:49:21
【问题描述】:
我无法使用类似于 Pinterest 的 SVG 精灵制作 CSS 动画。 精灵是 90 帧,但我无法让它工作
Pinterest 反应表情符号
View Pinterest Sprite 90 frames in Svg
我的代码:
.emoji{
width: 110px;
height: 110px;
background-image : url(https://s.pinimg.com/webapp/style/images/wow-0a7ea725.svg);
animation: moveX 1s steps(90) infinite;
}
@keyframes moveX{
from{background-position-x:0px;}
to{background-position-x:-500px;}
}
<div class="emoji"></div>
我的 JSFiddle:
【问题讨论】:
-
您的代码的唯一问题是,您没有正确设置图像的宽度......如果您改用
to{background-position-x:-100%;},它会像一个魅力;-)跨度>
标签: css svg css-animations