Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Explanation on how to draw a straight line in Raphael.js

Tags:

svg

raphael

I would like some help on the path constructor in Raphael. Im not sure how to draw a straight line from one point to another. I have

var line = paper.path(M 100 0 1 0 30 100)

I want to draw a line from point1 (100 0) to point2 (30 100)

like image 988
Wesley Skeen Avatar asked Nov 15 '12 19:11

Wesley Skeen


1 Answers

It's very simple:

var line = paper.path( "M100,0 L30,100" );

You can also build your paths out of arrays, which is really useful in some circumstances.

var line = paper.path( ["M", 100, 0, "L", 30, 100 ] );
like image 199
Kevin Nielsen Avatar answered Oct 21 '22 09:10

Kevin Nielsen