{"id":29751745,"url":"https://github.com/vasturiano/d3-force-surface","last_synced_at":"2025-07-26T14:42:04.259Z","repository":{"id":20605720,"uuid":"90405938","full_name":"vasturiano/d3-force-surface","owner":"vasturiano","description":"A multi-surface elastic collision force type for the d3-force simulation engine","archived":false,"fork":false,"pushed_at":"2025-06-05T23:05:57.000Z","size":138,"stargazers_count":23,"open_issues_count":2,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-07-23T10:29:37.008Z","etag":null,"topics":["d3js","elastic-collision","force","force-directed-graphs","graph-theory","impact","physics-simulation","simulation","surface"],"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/vasturiano.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,"zenodo":null}},"created_at":"2017-05-05T18:36:46.000Z","updated_at":"2025-06-05T23:05:59.000Z","dependencies_parsed_at":"2025-06-06T00:19:00.590Z","dependency_job_id":"0483668c-39f8-4ba8-871d-fd627d59b208","html_url":"https://github.com/vasturiano/d3-force-surface","commit_stats":{"total_commits":62,"total_committers":2,"mean_commits":31.0,"dds":0.08064516129032262,"last_synced_commit":"c1af600f1d09783859efd2475f4bbe5c7e67a95c"},"previous_names":[],"tags_count":23,"template":false,"template_full_name":null,"purl":"pkg:github/vasturiano/d3-force-surface","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vasturiano%2Fd3-force-surface","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vasturiano%2Fd3-force-surface/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vasturiano%2Fd3-force-surface/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vasturiano%2Fd3-force-surface/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vasturiano","download_url":"https://codeload.github.com/vasturiano/d3-force-surface/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vasturiano%2Fd3-force-surface/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267180079,"owners_count":24048483,"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","status":"online","status_checked_at":"2025-07-26T02:00:08.937Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["d3js","elastic-collision","force","force-directed-graphs","graph-theory","impact","physics-simulation","simulation","surface"],"created_at":"2025-07-26T14:42:00.656Z","updated_at":"2025-07-26T14:42:04.254Z","avatar_url":"https://github.com/vasturiano.png","language":"JavaScript","funding_links":["https://www.paypal.com/cgi-bin/webscr?cmd=_donations\u0026business=L398E7PKP47E8\u0026currency_code=USD\u0026source=url"],"categories":[],"sub_categories":[],"readme":"d3.forceSurface\n==============\n\n[![NPM package][npm-img]][npm-url]\n[![Build Size][build-size-img]][build-size-url]\n[![NPM Downloads][npm-downloads-img]][npm-downloads-url]\n\nA multi-surface elastic collision force type for the d3-force simulation engine.\n\nIt can be used, for example to [keep nodes within boundaries](https://observablehq.com/@vasturiano/entropy) or in a [game of Pong](https://observablehq.com/@vasturiano/quad-pong).\n\nSee also [d3.forceBounce](https://github.com/vasturiano/d3-force-bounce).\n\n## Quick start\n\n```js\nimport d3ForceSurface from 'd3-force-surface';\n```\nor using a *script* tag\n```html\n\u003cscript src=\"//cdn.jsdelivr.net/npm/d3-force-surface\"\u003e\u003c/script\u003e\n```\nthen\n```js\nd3.forceSimulation()\n    .nodes(\u003cmyNodes\u003e)\n    .force('surface', d3.forceSurface()\n        .surfaces(\u003cmySurfaces\u003e)\n    );\n```\n\n## API reference\n\n| Method | Description | Default |\n| ------------------ | -------------------------------------------------------------------------------------------------------------------------- | ------------- |\n| \u003cb\u003esurfaces\u003c/b\u003e([\u003ci\u003earray\u003c/i\u003e]) | Getter/setter for the list of surface lines | [] |\n| \u003cb\u003eelasticity\u003c/b\u003e([\u003ci\u003enumber\u003c/i\u003e]) | Getter/setter for every collision's \u003ci\u003ecoefficient of restitution\u003c/i\u003e, aka \u003ci\u003eelasticity\u003c/i\u003e. A value of `1` represents a purely elastic collision with no energy loss, while a `0` will fully eliminate the bounce in the collision direction. Values `\u003e1` can be used to introduce acceleration at each collision. Values `\u003c0` are not recommended. | 1 |\n| \u003cb\u003eradius\u003c/b\u003e([\u003ci\u003enum\u003c/i\u003e or \u003ci\u003efn\u003c/i\u003e]) | Getter/setter for the node object radius accessor function (`fn(node)`) or a constant (`num`) for all nodes. | 1 |\n| \u003cb\u003efrom\u003c/b\u003e([\u003ci\u003efn\u003c/i\u003e]) | Getter/setter for the surface object \u003cb\u003estarting point\u003c/b\u003e accessor function `fn(surface)`. It should return a two coordinate object: `{x,y}` | `surface.from` |\n| \u003cb\u003eto\u003c/b\u003e([\u003ci\u003efn\u003c/i\u003e]) | Getter/setter for the surface object \u003cb\u003eending point\u003c/b\u003e accessor function `fn(surface)`. It should return a two coordinate object: `{x,y}` | `surface.to` |\n| \u003cb\u003eoneWay\u003c/b\u003e([\u003ci\u003ebool\u003c/i\u003e or \u003ci\u003efn\u003c/i\u003e]) | Getter/setter for the surface object \"one-way\" flag accessor function (`fn(surface)`) or a constant for all surfaces. This flag indicates whether collisions of nodes against the surface should occur in both directions of movement or only in one (when the node is moving in a \u003ci\u003eN\u003eS\u003c/i\u003e orientation according to the \u003ci\u003eW\u003eE\u003c/i\u003e line axis), effectively ignoring collisions in the other direction. | false |\n| \u003cb\u003eonImpact\u003c/b\u003e([\u003ci\u003efn\u003c/i\u003e]) | Callback function triggered at every collision, with the signature `onImpact(node, surface)`  ||\n\n## ❤️ Support This Project\n\nIf you find this module useful and would like to support its development, you can [buy me a ☕](https://www.paypal.com/cgi-bin/webscr?cmd=_donations\u0026business=L398E7PKP47E8\u0026currency_code=USD\u0026source=url). Your contributions help keep open-source sustainable!\n[![paypal](https://www.paypalobjects.com/en_US/i/btn/btn_donate_SM.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_donations\u0026business=L398E7PKP47E8\u0026currency_code=USD\u0026source=url)\n\n\n[npm-img]: https://img.shields.io/npm/v/d3-force-surface\n[npm-url]: https://npmjs.org/package/d3-force-surface\n[build-size-img]: https://img.shields.io/bundlephobia/minzip/d3-force-surface\n[build-size-url]: https://bundlephobia.com/result?p=d3-force-surface\n[npm-downloads-img]: https://img.shields.io/npm/dt/d3-force-surface\n[npm-downloads-url]: https://www.npmtrends.com/d3-force-surface\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvasturiano%2Fd3-force-surface","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvasturiano%2Fd3-force-surface","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvasturiano%2Fd3-force-surface/lists"}