I'm a beginner at CSS and I wanted to code an image animation in which the image starts appearing from the bottom right corner until the top left corner.
I couldn't do the animation on the image itself, I ended up adding a div element with the same background-color above the image
would anyone please teach me how to do the animation in a more professional way without using the div?
I don't mind if the code was using pure CSS or JS.
here is the code I wrote:
.personal-photo {
padding: 4rem;
z-index: -10;
}
.photo-effect {
position: absolute;
padding: 42%;
top: 91px;
left: 91px;
background-image: linear-gradient(120deg, #fff 0%, #fff 50%, transparent 50%);
background-size: 300%;
animation: photoEffect 2s infinite;
z-index: 10;
}
@keyframes photoEffect {
100% {
background-position: 100%;
}
}
<div class="container">
<img src="https://placekitten.com/200/300" class="personal-photo" alt="">
<div class="photo-effect"></div>
</div>