I'm trying to make an animation with CSS that would be a "sun" going through an image.
The idea was to have something next of this result:
Butinmycodethe"sun" jumps from side to side and does not get animated in the right way. How do I animate with CSS this readial-gradient
(or linear-gradiente
) in the correct way?
I tried to use @keyframes
and change properties
From: radial-gradient(circle at 100% 50%...
To: radial-gradient(circle at 0% 50%...
But it did not work out as you can see below
.box {
width: 300px;
height: 150px;
background-image: radial-gradient(circle at 100% 50%, rgba(255, 155, 61, 0.473), transparent 25%), url(https://unsplash.it/300/150?image=986);
background-size: cover;
background-repeat: no-repeat;
animation: bg 3s linear infinite, none;
}
@keyframes bg {
to {
background-image: radial-gradient(circle at 0% 50%, rgba(255, 155, 61, 0.473), transparent 25%), url(https://unsplash.it/300/150?image=986);
}
}
<div class="box"></div>