<div className="sound-wave-container py-8">
<img
src={!recording ? Wave : DottedLine}
className={!recording ? "sound-wave" : ""}
alt="Sound Wave"
/>
</div>
.sound-wave-container {
outline: 1px inset #999;
position: relative;
overflow: hidden;
width: 300px;
}
/* Define the animation */
@keyframes moveRightInfinity {
0% {
transform: translateX( 0%);
/* Start from the left boundary of the container */
}
100% {
transform: translateX( calc(100% - 100px));
/* Move to the right, but stop before it fully exits the view. Adjust the "100px" to the width of your image if it's different */
}
}
/* Apply the animation to the image */
.sound-wave {
animation: moveRightInfinity 10s linear infinite;
}
<div class="sound-wave-container py-8">
<img src="https://placekitten.com/200/300" class="sound-wave" alt="Sound Wave" />
</div>
It is currently extending beyond the div boundaries. I need to contain it within the frame and make it continually scroll in the right direction to always appear full.