M
M
Maxim Timofeev2016-10-05 16:57:28
JavaScript
Maxim Timofeev, 2016-10-05 16:57:28

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

3 answer(s)
M
Maxim Timofeev, 2016-10-05
@webinar

I did this: instead of rect, I used path and just changed to a new path, for animation, just a transition in css

G
Greg Popov, 2016-10-05
@Gregpopov

Such things are better done with css, and in your case you just need to specify the translate coordinates, then everything will work.

M
masambrero, 2016-10-05
@masambrero

У вас отрисовка идет от значения смещения по оси Y до значения высоты. Если вы хотите, чтобы смещение шло от центра, то начальный Y должен быть центром оси, а вы его меняете каждый раз на случайное значение.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question