{"name":"bezier","description":"n-degree Bezier interpolation","version":"0.1.0","main":"index.js","browser":"index.js","dependencies":{},"devDependencies":{"tape":"~1.1.1"},"scripts":{"test":"node test.js"},"author":{"name":"Hugh Kennedy","email":"hughskennedy@gmail.com","url":"http://github.com/hughsk"},"license":"MIT","repository":{"type":"git","url":"git://github.com/hughsk/bezier"},"bugs":{"url":"https://github.com/hughsk/bezier/issues"},"keywords":["bezier","curve","spline"],"readme":"# bezier [![experimental](http://hughsk.github.io/stability-badges/dist/experimental.svg)](http://github.com/hughsk/stability-badges) #\n\nn-degree Bezier curve interpolation.\n\n## Usage ##\n\n[![bezier](https://nodei.co/npm/bezier.png?mini=true)](https://nodei.co/npm/bezier)\n\n### `require('bezier')(points, t)` ###\n\nReturns the value at `t` for a bezier curve of `points.length` degrees.\nIn other words, if you pass it a 3-element array you'll get the results of a\n3-degree (quadratic) curve.\n\n``` javascript\nvar bezier = require('bezier')\nbezier([0, 1, 2], 0.5)    // 1\nbezier([0, 1, 2, 3], 0.5) // 1.5\n```\n\nYou can use a curve for each dimension to get the resulting bezier you're\nprobably familiar with:\n\n``` javascript\nvar canvas = document.createElement('canvas')\nvar ctx = canvas.getContext('2d')\n\nvar bezier = require('bezier')\nvar x = [0, 1, 2]\nvar y = [2, 1, 0]\n\nctx.beginPath()\nctx.strokeStyle = '#000'\nfor (var t = 0; t < 1; t += 0.01) {\n  ctx.lineTo(bezier(x, t), bezier(y, t))\n}\nctx.stroke()\nctx.closePath()\n```\n\n### `curve = require('bezier').prepare(pointCount)` ###\n\nGenerates a function which takes `pointCount` number of points to draw a\nbezier curve. For higher values of `pointCount`, this function is generated on\nthe fly such that it can run with as little overhead as possible.\n\nIt's a small trade-off in flexibility for a small benefit in performance :)\n\n### `curve(points, t)` ###\n\nGiven an array of `points` that is `pointCount` long, return the value across\nthe curve at `t`.\n\n``` javascript\nvar quadratic = require('bezier').prepare(3)\nvar cubic = require('bezier').prepare(4)\n\nquadratic([0, 1, 2], 0.5) // 1\ncubic([0, 1, 2, 3], 0.5)  // 1.5\n\n// Note that these functions expect\n// arrays of the correct length:\nquadratic([0, 1, 2, 3], 0.5) // 1\nquadratic([0, 1], 0.5)       // NaN\n```\n\n## License ##\n\nMIT. See [LICENSE.md](http://github.com/hughsk/bezier/blob/master/LICENSE) for details.\n","readmeFilename":"README.md","_id":"bezier@0.1.0","dist":{"shasum":"fad143502b21e378a3181ffe50baac97ad24909e","tarball":"http://registry-npm.ywwl.com/bezier/download/bezier-0.1.0.tgz","integrity":"sha512-2XI2zrtf+NBiIkcAjXwtZ+fWMT5p/5x8DXwSltCxDTOQXyh0bgJ+Llbt8WvTcR1SRhAF38ei6S585GrTXI65sQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCPSPsm/YBfPTC3wh07jBVAJO13UMwCZlZExyAK4r4uMwIgSI7fNuOV0Gf98vQ/yJaupXa7+MGd+Tso25+sa7HnM7A="}],"size":2952,"noattachment":false,"key":"/bezier/-/bezier-0.1.0.tgz"},"_from":".","_npmVersion":"1.3.11","_npmUser":{"name":"hughsk","email":"hughskennedy@gmail.com"},"maintainers":[{"name":"hughsk","email":"hughskennedy@gmail.com"}],"directories":{},"publish_time":1380593381328,"_cnpm_publish_time":1380593381328,"dist-tags":{"latest":"0.1.0"}}