I am trying to get some html elements to follow each other along the SVG path. I would like them to stay at the same distance from each other as they walked along the path. I would also like the SVG image to scale in the container that holds it.
I created an encoder that demonstrates what I still have: http://codepen.io/mikes000/pen/GIJab
The problem I am facing is that when the elements move along the X axis, they seem even more spaced than on the Y axis.
Is there a way to make them stay at the same distance when they travel along the line?
Thanks!
Update **
After continuing for some time, I found that the change in distance was apparently due to the aspect ratio of the SVG screen increasing for X more than for Y. When it is stretched down along the X axis 1px down, the line may 3px on the screen.
The position of the red squares is set by moving them in front and behind half the width of the black box. When moving along a line, if the aspect ratio of the viewport changes, the distance between each point of the line increases or decreases based on this.
I tried to create a similar SVG with the exact viewbox size of the div container, and the red dots are exactly at the ends of the black box to the end of the line. This does not solve the problem, because I would like the SVG with the line to scale to any container of the size in which it is placed inside.
I think that if there is a way to calculate how many pixels the size of the black box depending on how many pixels along the line covering the red dots will exactly match.
Any ideas on how to do this or which ideas are better suited to solve this problem?
source share