I'm currently working on adding a continuous keyframe animation to the background image in the hero section of a page, using the translateX property for animation.
While it is functioning properly, I am encountering an issue where the animation abruptly restarts from the beginning instead of smoothly transitioning back.
I am looking for a solution to ensure that the animation progresses seamlessly without any disruptions.
body,html{
height:100%;
width: 100%;
}
<script src="https://cdn.tailwindcss.com"></script>
<script>
tailwind.config = {
theme: {
extend: {
keyframes: {
slide: {
'0%': { transform: "translateX(0)" },
'100%': { transform: "translateX(-2509px)" },
},
slidemobile: {
from: { transform: "translateX(0)" },
to: { transform: "translateX(-375px)" },
},
},
animation: {
slide: "slide 45s infinite linear",
slidemobile: "slidemobile 20s infinite linear",
},
}
}
}
</script>
<div id="img-background" class="bg-contain bg-repeat-x h-full animate-slidemobile w-[1125px] bg-[url('https://picsum.photos/200')] sm:animate-slide sm:w-[7527px]">
</div>