I have made some changes to the fiddle, and it seems to work. One point seems to be that the last left
coordinate in the transformation should be the total length of the svg
minus the length of the window. In the fiddle, you can change
transform: translate(calc(-1 * var(--steps) * var(--w)));
to
transform: translate(calc(-1 * calc(var(--steps) - 1) * var(--w)));
In your snippet, the transform: translate(-100%);
percentage should be (2300/2400)*100
.
More importantly, I have added the width='2400'
property to the svg
. The matter of setting a missing length property for an svg is quite complex, and I do not think that every browser behaves the same way.
In the fiddle, I have changed the --w
property to 100, which is the height and width of each svg frame. If you want to set it to 200, you would need to change the size of the svg and the coordinates of each frame proportionally.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…