I'm trying to animate a loading icon using an image. What I'm trying to achieve is to have the image animate between two colours from left to right infinitely. This is done in Angular 7. I'm new to animations but as far as I understand I can solve this with CSS animations.
What I want is something similar to the example below. Only I want the grayscale to disappear to the right, and instead of a grayscale I want to pick two different colours.
All help is appreciated!
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>