svgdotjs / svg.js

The lightweight library for manipulating and animating SVG
https://svgjs.dev
Other
10.97k stars 1.07k forks source link

Path animation #1229

Closed antonioaltamura closed 2 years ago

antonioaltamura commented 2 years ago

I'm not clear if and how you can animate paths. It seems https://github.com/otm/svg.path.js is not totally compatible with the svg.js v3.

https://jsfiddle.net/alfredopacino/6qgjv39L/6/

Fuzzyma commented 2 years ago

This plug in is not maintained by us

antonioaltamura commented 2 years ago

There is no way to animate path then?

Fuzzyma commented 2 years ago

There is. But that plugin you mentioned doenst have anything to do with animation. For path animation to work, you have to align the paths in a way that they both contain the same path commands. Only then it can be animated.

const path = canvas.path('M 0 0 10 10').animate().plot('M 0 0 20 20')

// EDIT: Just read that the plugin actually provides some way to animate paths but as I said we don't maintain it - so you should open the issue on their repo

antonioaltamura commented 2 years ago

Thanks. You should put that in your documentation.

Fuzzyma commented 2 years ago

https://svgjs.dev/docs/3.1/shape-elements/#path-plot