javascript - Animate a circle being drawn using Paper.js -
i'm trying animate circle being drawn using paper.js.
as circle tool quick access instantiating path constructed via moveto/arcto etc, there no arguments support start , end angles (for open pie chart-like circles).
what looking way animate circle being drawn it's first point angle of choice @ radius.
the actual canvas specification allows explicit startangle , endangle specified. if case within paper.js achieve looking for. however, within paper.js have yet come across method of replicating such control. created in fabric.js worked fabric's implementation of circle shape used same attributes arc command in specification.
does know of way can achieved can animate endangle?
here's conversion function accepts html5 canvas arc arguments , returns from, through, to
arguments needed paper.js arc.
function canvasarctopaperarc(cx,cy,radius,startangle,endangle,strokecolor){ var startx=cx+radius*math.cos(startangle); var starty=cy+radius*math.sin(startangle); var endx=cx+radius*math.cos(endangle); var endy=cy+radius*math.sin(endangle); var thrux=cx+radius*math.cos((endangle-startangle)/2); var thruy=cy+radius*math.sin((endangle-startangle)/2); var = new point(startx,starty); var through = new point(thrux,thruy); var = new point(endx,endy); return({from:from, through:through, to:to}); }
Comments
Post a Comment