我想使用图像来制作一个加载图标的动画。 我试图实现的是让图片在从左到右之间无限循环地动画变换两种颜色。 这是在Angular 7中完成的。 我对动画不熟悉,但据我所知,可以通过CSS动画解决这个问题。
我想要的是类似下面示例的效果。 只是我希望灰度消失到右边,并且我想选择两种不同的颜色。
非常感谢您的帮助!
我想要的是类似下面示例的效果。 只是我希望灰度消失到右边,并且我想选择两种不同的颜色。
非常感谢您的帮助!
body {
margin: 0;
}
.effect {
position: relative;
}
.effect-dup {
filter: grayscale(100%);
position: absolute;
overflow: hidden;
top: 0;
left: 0;
width: 0;
animation: width 1s ease-in-out;
animation-fill-mode: forwards;
}
@keyframes width {
from {
width: 0;
}
to {
width: 100%;
}
}
<div class="effect">
<img src="https://placeimg.com/640/480/nature" />
<div class='effect-dup'><img src="https://placeimg.com/640/480/nature" /></div>
</div>
<div class="effect">
<img src="https://placeimg.com/640/480/tech" />
<div class='effect-dup'>
<img src="https://placeimg.com/640/480/tech" />
</div>
</div>
filter: grayscale(100%)
更改为您想要的 filter... - Heretic Monkey.effect
)中。 - Heretic Monkey