javascript - Can I modify the points on an existing path using Snap? -


i have svg path element:

<path d="m54.7,0.8 l111.8,73.4 l79.9,126.1 l27.9,128.7 l0.5,74.2 l54.7,0.8 z" id="shape"></path> 

i understand svg path's meaning:

  • m moves point
  • the ls draw lines
  • z closes path, producing polygon

and know can snapsvg manipulable object with:

var graph = snap(".graph"); var item = graph.select('#after #shape'); 

but can't find how modify path in the snap docs. i've looked @ item's paper.path can't see examples of changing paths, new ones.

how can modify existing path in snapsvg? ideally, i'd animate change in paths, ie, going old polygon new one.

you can animate d (path descriptions) other snapsvg items:

var graph = snap(".graph"); var item = graph.select('#after #shape'); 

get existing points:

item.attr('d') 

then animate them:

item.animate({   d: "m81.8,0.1 l146.8,85.1 l124.1,164.4 l39.7,164.4 l0.6,79.7 l81.8,0.1 z" }, 1500, mina.easeout) 

Comments

Popular posts from this blog

java - Plugin org.apache.maven.plugins:maven-install-plugin:2.4 or one of its dependencies could not be resolved -

Round ImageView Android -

How can I utilize Yahoo Weather API in android -