I want to create an animation of a curved line that moves like on an edge of egg shell from left to right. Here is what i’ve already done.
.box {
width: 25px;
height: 100px;
border: solid 3px #000;
border-color: transparent transparent transparent #000;
border-radius: 50%/50px 0 0 50px;
animation: animation 4s infinite;
}
@keyframes animation {
0% {
transform: rotateY(0deg);
}
50% {
transform: rotateY(180deg);
}
100% {
transform: rotateY(0deg);
}
}
and a simple div tag
<div class="box"></div>
The problem is that the border’s width is changing while rotating and completely dissapears when rotated by 90/270 degrees. How can i fix that?
3
Answers
I think you want something like that.
I think you have a good codebase now, which you can arrange as you want.
To make the HTML+CSS curved line animation you have no out-of-the-box, simple solution.
My suggestion would be to use canvas and program the object’s movement with javascript.
However, I made this snipped with elements that are resembling some smooth movement from one side to another.
The code could be improved so all of the valuable feedback is appreciated.