{"_id":"point-at-length","_rev":"374770","name":"point-at-length","description":"compute a point from an svg path string","dist-tags":{"latest":"1.1.0"},"maintainers":[{"name":"mkaemmerer","email":"matthew.kaemmerer@gmail.com"}],"time":{"modified":"2021-07-30T05:38:53.000Z","created":"2014-12-16T04:15:46.084Z","1.1.0":"2017-10-16T04:52:48.388Z","1.0.2":"2017-01-31T13:59:51.070Z","1.0.1":"2015-02-22T18:55:27.873Z","1.0.0":"2014-12-16T04:15:46.084Z"},"users":{"wfalkwallace":true,"rveciana":true},"author":{"name":"James Halliday","email":"mail@substack.net","url":"http://substack.net"},"repository":{"type":"git","url":"git://github.com/substack/point-at-length.git"},"versions":{"1.1.0":{"name":"point-at-length","version":"1.1.0","description":"compute a point from an svg path string","main":"index.js","dependencies":{"abs-svg-path":"~0.1.1","isarray":"~0.0.1","parse-svg-path":"~0.1.1"},"devDependencies":{"tape":"^3.0.0"},"scripts":{"test":"tape test/*.js"},"repository":{"type":"git","url":"git://github.com/substack/point-at-length.git"},"homepage":"https://github.com/substack/point-at-length","keywords":["getPointAtLength","getTotalLength","svg"],"engine":{"node":"*","browser":"*"},"author":{"name":"James Halliday","email":"mail@substack.net","url":"http://substack.net"},"license":"MIT","gitHead":"4242b5bd9a3bf13f28b4b244a3496904599e76b5","bugs":{"url":"https://github.com/substack/point-at-length/issues"},"_id":"point-at-length@1.1.0","_shasum":"0ad72ebd0980d7f5a1ab12296c055f9eb6b30e57","_from":".","_npmVersion":"3.10.10","_nodeVersion":"6.11.1","_npmUser":{"name":"mkaemmerer","email":"matthew.kaemmerer@gmail.com"},"dist":{"shasum":"0ad72ebd0980d7f5a1ab12296c055f9eb6b30e57","size":5828,"noattachment":false,"key":"/point-at-length/-/point-at-length-1.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/point-at-length/download/point-at-length-1.1.0.tgz"},"maintainers":[{"name":"mkaemmerer","email":"matthew.kaemmerer@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/point-at-length-1.1.0.tgz_1508129568310_0.6202202527783811"},"directories":{},"publish_time":1508129568388,"_hasShrinkwrap":false,"_cnpm_publish_time":1508129568388},"1.0.2":{"name":"point-at-length","version":"1.0.2","description":"compute a point from an svg path string","main":"index.js","dependencies":{"abs-svg-path":"~0.1.1","isarray":"~0.0.1","parse-svg-path":"~0.1.1"},"devDependencies":{"tape":"^3.0.0"},"scripts":{"test":"tape test/*.js"},"repository":{"type":"git","url":"git://github.com/substack/point-at-length.git"},"homepage":"https://github.com/substack/point-at-length","keywords":["getPointAtLength","getTotalLength","svg"],"engine":{"node":"*","browser":"*"},"author":{"name":"James Halliday","email":"mail@substack.net","url":"http://substack.net"},"license":"MIT","gitHead":"8ed2c23a619e9d7cc526d497dad8fcbb65fe5aad","bugs":{"url":"https://github.com/substack/point-at-length/issues"},"_id":"point-at-length@1.0.2","_shasum":"9176d8d6d7c8162f12b646f707db9f0ea728125e","_from":".","_npmVersion":"3.10.5","_nodeVersion":"6.3.1","_npmUser":{"name":"substack","email":"substack@gmail.com"},"dist":{"shasum":"9176d8d6d7c8162f12b646f707db9f0ea728125e","size":5402,"noattachment":false,"key":"/point-at-length/-/point-at-length-1.0.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/point-at-length/download/point-at-length-1.0.2.tgz"},"maintainers":[{"name":"mkaemmerer","email":"matthew.kaemmerer@gmail.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/point-at-length-1.0.2.tgz_1485871190834_0.7350571763236076"},"directories":{},"publish_time":1485871191070,"_cnpm_publish_time":1485871191070,"_hasShrinkwrap":false},"1.0.1":{"name":"point-at-length","version":"1.0.1","description":"compute a point from an svg path string","main":"index.js","dependencies":{"abs-svg-path":"~0.1.1","isarray":"~0.0.1","parse-svg-path":"~0.1.1"},"devDependencies":{"tape":"^3.0.0"},"scripts":{"test":"tape test/*.js"},"repository":{"type":"git","url":"git://github.com/substack/point-at-length.git"},"homepage":"https://github.com/substack/point-at-length","keywords":["getPointAtLength","getTotalLength","svg"],"engine":{"node":"*","browser":"*"},"author":{"name":"James Halliday","email":"mail@substack.net","url":"http://substack.net"},"license":"MIT","gitHead":"de87b493e223ec0f4d19b8ff577bab4b2829d3ab","bugs":{"url":"https://github.com/substack/point-at-length/issues"},"_id":"point-at-length@1.0.1","_shasum":"cfd860a1bec76cb1b02e9523551427efe881f7d7","_from":".","_npmVersion":"2.3.0","_nodeVersion":"0.12.0","_npmUser":{"name":"substack","email":"mail@substack.net"},"maintainers":[{"name":"mkaemmerer","email":"matthew.kaemmerer@gmail.com"}],"dist":{"shasum":"cfd860a1bec76cb1b02e9523551427efe881f7d7","size":5141,"noattachment":false,"key":"/point-at-length/-/point-at-length-1.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/point-at-length/download/point-at-length-1.0.1.tgz"},"directories":{},"publish_time":1424631327873,"_cnpm_publish_time":1424631327873,"_hasShrinkwrap":false},"1.0.0":{"name":"point-at-length","version":"1.0.0","description":"compute a point from an svg path string","main":"index.js","dependencies":{"abs-svg-path":"~0.1.1","isarray":"~0.0.1","parse-svg-path":"~0.1.1"},"devDependencies":{"tape":"^3.0.0"},"scripts":{"test":"tape test/*.js"},"repository":{"type":"git","url":"git://github.com/substack/point-at-length.git"},"homepage":"https://github.com/substack/point-at-length","keywords":["getPointAtLength","getTotalLength","svg"],"engine":{"node":"*","browser":"*"},"author":{"name":"James Halliday","email":"mail@substack.net","url":"http://substack.net"},"license":"MIT","gitHead":"105fe08505f72e8751d35f71fb0c161f62cd8435","bugs":{"url":"https://github.com/substack/point-at-length/issues"},"_id":"point-at-length@1.0.0","_shasum":"dfad2b3241dd37aa3bfabe49ca9aa811a1abe776","_from":".","_npmVersion":"2.1.12","_nodeVersion":"0.10.31","_npmUser":{"name":"substack","email":"mail@substack.net"},"maintainers":[{"name":"mkaemmerer","email":"matthew.kaemmerer@gmail.com"}],"dist":{"shasum":"dfad2b3241dd37aa3bfabe49ca9aa811a1abe776","size":4999,"noattachment":false,"key":"/point-at-length/-/point-at-length-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/point-at-length/download/point-at-length-1.0.0.tgz"},"directories":{},"publish_time":1418703346084,"_cnpm_publish_time":1418703346084,"_hasShrinkwrap":false}},"readme":"# point-at-length\r\n\r\ncompute a point from an svg path string\r\n\r\nThis is like `path.getPointAtLength(t)` for an svg `<path>` element, but works\r\nin node + browsers.\r\n\r\nIf you're in the browser, it's best to use the native svg implementation since\r\nthat will be faster and more accurate.\r\n\r\n[![build status](https://secure.travis-ci.org/substack/point-at-length.png)](http://travis-ci.org/substack/point-at-length)\r\n\r\n# example\r\n\r\n``` js\r\nvar point = require('point-at-length');\r\nvar pts = point(process.argv.slice(2).join(' '));\r\n\r\nvar len = pts.length();\r\n\r\nfor (var i = 0; i <= 10; i++) {\r\n    console.log(i / 10, pts.at(i / 10 * len));\r\n}\r\n```\r\n\r\nand then given an svg path:\r\n\r\n```                                                                       |\r\n$ node percent.js m 340.0802,61.38651 c -40.2898,8.22791 \\\r\n  -62.56591,65.81112 -49.74004,128.6158 12.82587,62.80467 \\\r\n  55.90207,107.07364 96.19186,98.84572 40.2898,-8.22791 \\\r\n  62.55966,-65.84175 49.73379,-128.64642 C 423.43994,97.39694 \\\r\n  380.36999,53.15859 340.0802,61.38651 z m 12.91104,8.55846 c \\\r\n  22.51488,-4.59795 48.14062,27.6983 57.21553,72.13556 9.0749,44.43726 \\\r\n  -1.83609,84.19498 -24.35097,88.79294 -22.51489,4.59795 \\\r\n  -48.11001,-27.70455 -57.18492,-72.14182 -9.0749,-44.43726 \\\r\n  1.80548,-84.18872 24.32036,-88.78668 z\r\n0 [ 340.0802, 61.38651 ]\r\n0.1 [ 286.4845903594534, 135.39847858871894 ]\r\n0.2 [ 302.1571721534183, 238.7146891719936 ]\r\n0.3 [ 384.5741907293933, 289.20324985412464 ]\r\n0.4 [ 440.01448853962546, 216.81871101620578 ]\r\n0.5 [ 424.995580315864, 113.42989532988953 ]\r\n0.6 [ 344.0127910427327, 60.748668250007114 ]\r\n0.7 [ 409.3069687960253, 137.94315136324377 ]\r\n0.8 [ 387.80154792789017, 230.38180833710817 ]\r\n0.9 [ 329.13606555255416, 160.92824115677908 ]\r\n1 [ 352.99124, 69.94497 ]\r\n```\r\n\r\n# methods\r\n\r\n``` js\r\nvar point = require('point-at-length')\r\n```\r\n\r\n## var pts = point(svgpath)\r\n\r\nCreate a new `pt` instance given `svgpath`,\r\nan [svg path string](http://www.w3.org/TR/SVG11/paths.html#PathData),\r\nor an array that matches the format returned by\r\n[parse-svg-path](https://www.npmjs.com/package/parse-svg-path).\r\n\r\n## pts.length()\r\n\r\nCompute the total length of the path.\r\n\r\nThis method is based on the output of the `getTotalLength()` method of\r\n[svg path elements](https://developer.mozilla.org/en-US/docs/Web/API/SVGPathElement).\r\n\r\n## var xy = pts.at(len)\r\n\r\nCompute the `[x,y]` point `xy` from a distance `len` into the geometry.\r\n\r\n# install\r\n\r\nWith [npm](https://npmjs.org) do:\r\n\r\n```\r\nnpm install point-at-length\r\n```\r\n\r\n# license\r\n\r\nMIT\r\n","_attachments":{},"homepage":"https://github.com/substack/point-at-length","bugs":{"url":"https://github.com/substack/point-at-length/issues"},"license":"MIT"}