svg-morph
morph animation between two svg path arrays
example
main.js:
var morph = ;var pencil = ;var a = document;var b = document;var c = document;var pa = ;pa;var pb = ;pb;var pts = {};pa;pb;
index.html:
compile with browserify:
browserify main.js > bundle.js
then load index.html in a browser.
methods
var morph =
var m = morph(a, b, opts={})
Create a new morph animation svg that morphs between the point arrays a
and
b
. Each element in a
and b
is of the form [x,y]
.
The opts
are:
opts.svg
- append to this svg, otherwise one will be createdopts.fill
- fill color to use, default:'none'
opts.stroke
- stroke color to use, default:'black'
opts.strokeWidth
- stroke width to use, default:'1px'
opts.duration
- animation duration, default:'1s'
opts.repeatCount
- number of animation repetitions, default:'indefinite'
The svg will have a single <path>
element with an <animate>
tag containing
the morph data.
m.appendTo(target)
Append the m.element
svg to the dom element or query string target
.
install
With npm do:
npm install svg-morph
license
MIT