Explain how to draw a straight line in Raphael.js

I need help with a path builder in Raphael. I'm 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 point 1 (100 0) to point 2 (30 100)

+6
source share
1 answer

It is very simple:

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

You can also create your paths from arrays, which is really useful in some cases.

 var line = paper.path( ["M", 100, 0, "L", 30, 100 ] ); 
+15
source

All Articles