I am creating a Polyline
component using two positions with Typescript based on the react-leaflet
. I want to make an animation from the source to the destination. It should look like something is flowing between source to destination. I'm able to set the animation with CSS Animation
however, I have the issue that the transition between the last color( yellow at 100%) and return to the initial position (blue at 0%) is happening very abruptly, not smooth like other changes in between. I want these last changes also smooth like others so that it looks like a continuous flow. Here is my code,
React-leaflet Polyline
<Polyline
key={eachConnection.id}
weight={4}
className="water-flow"
positions={[[source.lat, source.long],[target.lat, target.long]]}
/>
CSS for the Polyline
.water-flow{
stroke: lime;
stroke-width: 3;
animation: 3s ease infinite Anim;
}
@keyframes Anim {
0%{
stroke : blue;
}
2%{
stroke: green;
}
50%{
stroke: red;
}
98%{
stroke: cyan;
}
100%{
stroke: yellow;
}
}