How does svg realize the animation of highlighting moving along with the path of the line, and the direction also follows the direction of the path?

this is your own. When you move, the direction of the element remains the same and will not rotate with the direction of the line



.

use the rotate property in animateMotion, which is the auto, portal https://www.w3.org/TR/SVG/ani.

Menu