Answer the question
In order to leave comments, you need to log in
How to make svg animation work properly?
There is this code https://jsfiddle.net/57s1rw1x/
An animation starts when the mouse moves. I would like the drawing to take place from the center of the y-axis and draw from the top point.
Look at the link, it will be clear.
Moreover, some correctly stretch from the middle to the edges, and some segments seem to fall down. Can't figure out why
Answer the question
In order to leave comments, you need to log in
I did this: instead of rect, I used path and just changed to a new path, for animation, just a transition in css
Such things are better done with css, and in your case you just need to specify the translate coordinates, then everything will work.
У вас отрисовка идет от значения смещения по оси Y до значения высоты. Если вы хотите, чтобы смещение шло от центра, то начальный Y должен быть центром оси, а вы его меняете каждый раз на случайное значение.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question