balance-svg-paths
Make two paths equivalent in terms of structure while respecting their original shapes. So they can be easily tweened and animated. Currently its a pretty half-ass implementation. See test/cases.js for an analysis.
Installation
With your favorite package manager:
- packin:
packin add balance-svg-paths
- component:
component install jkroso/balance-svg-paths
- npm:
npm install balance-svg-paths
then in your app:
var balance =
API
balance(a, b)
Define a
and b
using the same number of path segments while preserving their shapes. Where both a
and b
are normalized paths. It returns an Array containing the balanced paths in the same order they were input.
var a = 'c'00500500 'c'00050050var b = 'c'55455500 // => [a, b.concat([['c',0,0,0,0,0,0]])]