2

I have used http://readysetraphael.com/ to convert a svg to a path in raphaeljs. I am wanting to change it's position on the page. Eventually changing it with a variable that is random numbers so it moves around the screen on refresh.

http://jsfiddle.net/anderskitson/ZfzJg/

Currently When I attempt to move it messes the path up. From what I read in the documentation the path goes like "M10,20L30,40" so if I want to change the x,y coordinates of where the path is placed. Not sure how to do this without messing up the path itself

var path_a = paper.path("M242.07,270.119c0,0-14.596-30.606-7.625-35.793 c3.864-2.876,2.145-18.561,1.832-18.784c-0.313-0.224-1.839-0.319-1.839-0.319c-1.555-0.192-0.201-3.456-0.201-3.456 s0,0-0.598-0.352c-0.598-0.351,1.129-1.345,1.129-1.345c3.738-2.785,10.449-2.983,11.126-2.344c0.677,0.64-0.354,1.44-0.354,1.44 s0.73,0.832,1.333,2.111c0.604,1.28-0.792,1.665-0.792,1.665c1.852,6.718,9.877,14.935,9.877,14.935 c4.795,0.589,7.7,10.683,7.7,10.683l6.271,22.746C269.929,261.307,263.641,270.119,242.07,270.119z");
    path_a.attr({fill: 'none',stroke: '#231F20',"stroke-width": '3',"stroke-miterlimit": '10','stroke-opacity': '1'}).data('id', 'path_a');
Cool Guy Yo
  • 5,910
  • 14
  • 59
  • 89

1 Answers1

2

Figured it out, shouldn't give up on google so quickly. Found answer here path position with raphael

use translate method.

path_a.translate(100, 100);
Community
  • 1
  • 1
Cool Guy Yo
  • 5,910
  • 14
  • 59
  • 89