Drawing a curve using Raphael JavaScript library?

ⅰ亾dé卋堺 提交于 2019-12-24 11:08:47

问题


I'm drawing a curve from point A to point B. I know coordinates of points. How can I draw this curve. I have used example from Raphael site http://raphaeljs.com/curver.html, but I didn't understand how I should insert my own values to that function.


回答1:


Raphael is not computing a function for the curve, it directly uses SVG paths. Full spec is here http://www.w3.org/TR/SVG/paths.html#PathDataMovetoCommands .

In the example the path is defined here;

path2 = [["M", x, y], ["L", ax, ay], ["M", bx, by], ["L", zx, zy]];

Each sub-array represents a pen operation; moveto, closepath, lineto .




回答2:


You will want to use the Path method in Raphael (qv) with SVG path notation. The type of path to use would be one of cubic/quadratic bezier curve or elliptical arc depending on what kind of curve you want.



来源:https://stackoverflow.com/questions/6305382/drawing-a-curve-using-raphael-javascript-library

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!