fnused to add custom methods to the canvas .
Any methods that you add to fnwill work on the canvas. This contrasts with methods that will work on for example an element (for which you would use ). el
fn , Raphael ( , el ).
, :
Raphael.fn.arrow = function (x1, y1, x2, y2, size) {
return this.path( ... );
};
Raphael.fn.mystuff = {
arrow: function () {…},
star: function () {…},
};
var paper = Raphael(10, 10, 630, 480);
paper.arrow(10, 10, 30, 30, 5).attr({fill: "#f00"});
paper.mystuff.arrow();
paper.mystuff.star();
( AleksandraKos):
, Raphael 2.0