I have the following CSS code; The problem is that the animation works the way I want it, but resets after the 10 seconds are up and looks ugly. Ideally I'd like to have an infinite animation that, instead of restarting, wraps the image and when the left side of the image goes out of the canvas, comes back from the right.
@keyframes scrollRight { 0% { background-position-x: 30%; } 100% { background-position-x: 130%; } } .onrir { background-image: url('./text.svg'); background-repeat: no-repeat; background-size: cover; background-position: center; -webkit-text-fill-color: transparent; -webkit-background-clip: text; -webkit-text-stroke: 0.8px #fff; font-size: 10rem; line-height: 100%; background-size: 120% 120%; background-position: 30% -30%; animation: scrollRight 10s infinite linear forwards; }
I don't know how to implement this outside of keyframes.
EDIT: html tailwind code along with this.
<h1 class="font-bold text-center text-white"> <span class="onrir xs text-transparent bg-clip-text"> Who am I? </span> </h1>
You need to make sure the animation ends in the same position as it started...
Change
100%
to50%
and add100%
(same as0%
). (Multiply the animation duration by 2 to fit the original duration).(Untested (cannot reproduce exactly), but should work)
Demo: (Hope this is what you are referring to)