使用 Raphael JavaScript 库绘制曲线? [英] Drawing a curve using Raphael JavaScript library?

查看:27
本文介绍了使用 Raphael JavaScript 库绘制曲线?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在绘制一条从 A 点到 B 点的曲线.我知道点的坐标.我怎样才能画出这条曲线.我使用了来自 Raphael 网站 .

在示例中,路径在此处定义;

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

每个子数组代表一个笔操作;moveto, closepath, lineto .

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.

解决方案

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 .

这篇关于使用 Raphael JavaScript 库绘制曲线?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆