jquery - Changing the end point of a path in raphael -
i trying change end point of path drawn on raphael canvas cannot syntax right. here code. (the arguments of function call arrow.attr wrong have tried numerous combinations no avail):
window.onload = function() { var paper = new raphael(document.getelementbyid('canvas_container'), 500, 500); var circle = paper.circle(100, 100, 80); var arrow = paper.path("m 100 100 l -56.5 56.5 z"); arrow.attr({stroke: '#0a0', 'stroke-width': 3}); arrow.attr({'x2':80, 'y2':0}); } ; the raphael reference limited , know if there better reference somewhere else.
one way modify part of path store path details in array, modify parts required , reassign path string.
var paper = new raphael(document.getelementbyid('canvas_container'), 500, 500), patharray = ['m', 100, 100, 'l', 100, 100, 0, 100, 'z'], shape = paper.path(patharray.join(' ')); // modify last point (0, 100) (100, 0) patharray.splice(-3, 2, 100, 0); // reassign path string shape.attr({path: patharray.join(' ')}) hope helps.
Comments
Post a Comment