{"id":20119202,"url":"https://github.com/harrystevens/swoopy","last_synced_at":"2025-10-29T04:09:22.821Z","repository":{"id":42384380,"uuid":"234656290","full_name":"HarryStevens/swoopy","owner":"HarryStevens","description":"Draw swoopy lines.","archived":false,"fork":false,"pushed_at":"2024-09-23T23:18:36.000Z","size":417,"stargazers_count":7,"open_issues_count":3,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-19T08:16:04.255Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/HarryStevens.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-01-17T23:51:59.000Z","updated_at":"2024-09-23T23:18:35.000Z","dependencies_parsed_at":"2023-02-06T11:46:19.893Z","dependency_job_id":"ebcdf716-40da-4932-9e9f-b7b747e6988a","html_url":"https://github.com/HarryStevens/swoopy","commit_stats":{"total_commits":31,"total_committers":2,"mean_commits":15.5,"dds":"0.19354838709677424","last_synced_commit":"9907648ec1f1430afded6e8ffaf87c5226d480bc"},"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HarryStevens%2Fswoopy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HarryStevens%2Fswoopy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HarryStevens%2Fswoopy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HarryStevens%2Fswoopy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/HarryStevens","download_url":"https://codeload.github.com/HarryStevens/swoopy/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252703453,"owners_count":21790887,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-13T19:14:46.596Z","updated_at":"2025-10-29T04:09:17.788Z","avatar_url":"https://github.com/HarryStevens.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# swoopy\nDraw swoopy lines from one point to another. See it in action [here](https://observablehq.com/@harrystevens/hello-swoopy).\n\n## Installation\n\n### Web browser\nIn vanilla, a `swoopy` global is exported. You can use the latest version from unpkg.\n```html\n\u003cscript src=\"https://unpkg.com/swoopy@0.0.17/build/swoopy.js\"\u003e\u003c/script\u003e\n\u003cscript src=\"https://unpkg.com/swoopy@0.0.17/build/swoopy.min.js\"\u003e\u003c/script\u003e\n```\nIf you'd rather host it yourself, download the latest release from the [`build` directory](https://github.com/HarryStevens/swoopy/tree/master/build).\n\n### npm\n\n```bash\nnpm i swoopy -S\n```\n```js\nconst swoopy = require(\"swoopy\");\n```\n\n## API\n\n\u003ca name=\"arc\" href=\"#arc\"\u003e#\u003c/a\u003e swoopy.\u003cb\u003earc\u003c/b\u003e(\u003ci\u003ea\u003c/i\u003e, \u003ci\u003eb\u003c/i\u003e[, \u003ci\u003eoffset\u003c/i\u003e[, \u003ci\u003eprecision\u003c/i\u003e]]) · [Source](https://github.com/HarryStevens/swoopy/blob/master/src/arc.js \"Source\")\n\nReturns an array of points representing a circular arc running between point \u003ci\u003ea\u003c/i\u003e and point \u003ci\u003eb\u003c/i\u003e, both of which must be passed as an array of two numbers representing the x- and y-coordinates of the points. You may pass an optional \u003ci\u003eoffset\u003c/i\u003e representing how round you want your arc to be. If an offset is not specified, it defaults to 1, which will return the points of a semicircle. An offset of 0 returns the points of a straight line segment. You may pass an optional \u003ci\u003eprecision\u003c/i\u003e representing how precisely to interpolate between the two points. A lower precision corresponds to more points interpolated along the curve. If a precision is not specified, it defaults to 0.1.\n\n```js\nconst arc = swoopy.arc([0, 0], [10, 0]); // Returns the points of a semicircle between \u003c0, 0\u003e and \u003c10, 0\u003e.\n```\n\n\u003ca name=\"cat\" href=\"#cat\"\u003e#\u003c/a\u003e swoopy.\u003cb\u003ecat\u003c/b\u003e(\u003ci\u003ea\u003c/i\u003e, \u003ci\u003eb\u003c/i\u003e[, \u003ci\u003eoffset\u003c/i\u003e[, \u003ci\u003eprecision\u003c/i\u003e]]) · [Source](https://github.com/HarryStevens/swoopy/blob/master/src/cat.js \"Source\")\n\nReturns an array of points representing the [catenary curve](https://en.wikipedia.org/wiki/Catenary) running between point \u003ci\u003ea\u003c/i\u003e and point \u003ci\u003eb\u003c/i\u003e, both of which must be passed as an array of two numbers representing the x- and y-coordinates of the points. You may pass an optional \u003ci\u003eoffset\u003c/i\u003e representing how far perpendicularly from the midpoint of a and b to translate the control point of the Bézier curve. If an offset is not specified, it defaults to 0.5, or one-quarter the distance between a and b. You may pass an optional \u003ci\u003eprecision\u003c/i\u003e representing how precisely to interpolate between the two points. A lower precision corresponds to more points interpolated along the curve. If a precision is not specified, it defaults to 0.1. \n\n```js\nconst cat = swoopy.cat([0, 0], [10, 0]); // Returns the points of a catenary curve between \u003c0, 0\u003e and \u003c10, 0\u003e, with an offset that is one-quarter the distance between \u003c0, 0\u003e and \u003c10, 0\u003e.\n```\n\n\u003ca name=\"cubic\" href=\"#cubic\"\u003e#\u003c/a\u003e swoopy.\u003cb\u003ecubic\u003c/b\u003e(\u003ci\u003ea\u003c/i\u003e, \u003ci\u003eb\u003c/i\u003e[, \u003ci\u003eoffset\u003c/i\u003e[, \u003ci\u003eprecision\u003c/i\u003e]]) · [Source](https://github.com/HarryStevens/swoopy/blob/master/src/cubic.js \"Source\")\n\nReturns an array of points representing the cubic Bézier curve running between point \u003ci\u003ea\u003c/i\u003e and point \u003ci\u003eb\u003c/i\u003e, both of which must be passed as an array of two numbers representing the x- and y-coordinates of the points. You may pass an optional \u003ci\u003eoffset\u003c/i\u003e representing how far perpendicularly from the midpoint of a and b to translate the control points of the Bézier curve. If an offset is not specified, it defaults to 0.5, or one-quarter the distance between a and b. You may pass an optional \u003ci\u003eprecision\u003c/i\u003e representing how precisely to interpolate between the two points. A lower precision corresponds to more points interpolated along the curve. If a precision is not specified, it defaults to 0.1.  \n\n```js\nconst cubic = swoopy.cubic([0, 0], [10, 0]); // Returns the points of a cubic Bézier curve between \u003c0, 0\u003e and \u003c10, 0\u003e, with offsets that are one-quarter the distance between \u003c0, 0\u003e and \u003c10, 0\u003e.\n```\n\n\u003ca name=\"quad\" href=\"#quad\"\u003e#\u003c/a\u003e swoopy.\u003cb\u003equad\u003c/b\u003e(\u003ci\u003ea\u003c/i\u003e, \u003ci\u003eb\u003c/i\u003e[, \u003ci\u003eoffset\u003c/i\u003e[, \u003ci\u003eprecision\u003c/i\u003e]]) · [Source](https://github.com/HarryStevens/swoopy/blob/master/src/quad.js \"Source\")\n\nReturns an array of points representing the quadratic Bézier curve running between point \u003ci\u003ea\u003c/i\u003e and point \u003ci\u003eb\u003c/i\u003e, both of which must be passed as an array of two numbers representing the x- and y-coordinates of the points. You may pass an optional \u003ci\u003eoffset\u003c/i\u003e representing how far perpendicularly from the midpoint of a and b to translate the control point of the Bézier curve. If an offset is not specified, it defaults to 0.5, or one-quarter the distance between a and b. You may pass an optional \u003ci\u003eprecision\u003c/i\u003e representing how precisely to interpolate between the two points. A lower precision corresponds to more points interpolated along the curve. If a precision is not specified, it defaults to 0.1. \n\n```js\nconst quad = swoopy.quad([0, 0], [10, 0]); // Returns the points of a quadratic Bézier curve between \u003c0, 0\u003e and \u003c10, 0\u003e, with an offset that is one-quarter the distance between \u003c0, 0\u003e and \u003c10, 0\u003e.\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fharrystevens%2Fswoopy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fharrystevens%2Fswoopy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fharrystevens%2Fswoopy/lists"}