{"id":29751757,"url":"https://github.com/vasturiano/d3-force-constant","last_synced_at":"2025-10-24T19:39:23.265Z","repository":{"id":25540587,"uuid":"104412359","full_name":"vasturiano/d3-force-constant","owner":"vasturiano","description":"A constant acceleration force type for the d3-force simulation engine","archived":false,"fork":false,"pushed_at":"2025-06-05T23:06:58.000Z","size":108,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-07-12T03:49:27.502Z","etag":null,"topics":["acceleration-force","d3-force","d3js","force-simulation"],"latest_commit_sha":null,"homepage":"","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-09-22T00:30:01.000Z","updated_at":"2025-06-05T23:06:59.000Z","dependencies_parsed_at":"2023-01-14T02:55:25.836Z","dependency_job_id":"aa47d248-753d-4fe6-b023-ee8de6353d11","html_url":"https://github.com/vasturiano/d3-force-constant","commit_stats":{"total_commits":33,"total_committers":2,"mean_commits":16.5,"dds":"0.030303030303030276","last_synced_commit":"08ef58af1c6e5761bd6798fc8a3f7d55ee85f25d"},"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"purl":"pkg:github/vasturiano/d3-force-constant","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vasturiano%2Fd3-force-constant","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vasturiano%2Fd3-force-constant/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vasturiano%2Fd3-force-constant/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vasturiano%2Fd3-force-constant/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vasturiano","download_url":"https://codeload.github.com/vasturiano/d3-force-constant/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vasturiano%2Fd3-force-constant/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267180081,"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":["acceleration-force","d3-force","d3js","force-simulation"],"created_at":"2025-07-26T14:42:06.087Z","updated_at":"2025-10-24T19:39:18.241Z","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.forceConstant\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 constant acceleration force type for the [d3-force](https://github.com/d3/d3-force) simulation engine.\n\nThis force accelerates nodes in a particular direction by a constant amount at each tick. Both the force strength and the direction can be set custom per node, or global for all the nodes equally.\n\nIt can be used, for example to simulate weight caused by earth's gravity (constant acceleration pointing down), as well as wind blowing or a current flowing in an arbitrary direction.\n\nThis force plugin is also compatible with [d3-force-3d](https://github.com/vasturiano/d3-force-3d) and can function in a one, two (default) or three dimensional space.\n\n## Quick start\n\n```js\nimport d3ForceConstant from 'd3-force-constant';\n```\nor using a *script* tag\n```html\n\u003cscript src=\"//cdn.jsdelivr.net/npm/d3-force-constant\"\u003e\u003c/script\u003e\n```\nthen\n```js\nd3.forceSimulation()\n    .nodes(\u003cmyNodes\u003e)\n    .force('gravity', d3.forceConstant()\n        .strength(0.5)\n        .direction(90)   \n    );\n```\n\n## API reference\n\n| Method | Description | Default |\n| ------------------ | -------------------------------------------------------------------------------------------------------------------------- | ------------- |\n| \u003cb\u003estrength\u003c/b\u003e([\u003ci\u003enum\u003c/i\u003e or \u003ci\u003efn\u003c/i\u003e]) | Getter/setter for the node object strength accessor function (`fn(node)`) or a constant (`num`) for all nodes. This represents the strength of the force, in terms of velocity deltas per tick, i.e. `px/tick^2`.  | 1 |\n| \u003cb\u003edirection\u003c/b\u003e([\u003ci\u003enum\u003c/i\u003e or \u003ci\u003efn\u003c/i\u003e]) | Getter/setter for the node object direction accessor function (`fn(node)`) or a constant (`num`) for all nodes. This defines the orientation of the force in the XY plane in degrees, with `0` representing only X increases (rightwards in SVG convention) and `90` only Y increases (downwards).  | 90 |\n| \u003cb\u003ezAngle\u003c/b\u003e([\u003ci\u003enum\u003c/i\u003e or \u003ci\u003efn\u003c/i\u003e]) | Getter/setter for the node object Z axis angle accessor function (`fn(node)`) or a constant (`num`) for all nodes. Mainly applicable in 3D scenarios when using [d3-force-3d](https://github.com/vasturiano/d3-force-3d). This defines the angle of the force in degrees against the XY plane, with `0` indicating parallel (no Z influence) and `-90` (far) / `90` (near) perpendicular (`direction` has no effect in this case). Values below `-90` or above `90` invert direction on the XY plane. | 0 |\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-constant\n[npm-url]: https://npmjs.org/package/d3-force-constant\n[build-size-img]: https://img.shields.io/bundlephobia/minzip/d3-force-constant\n[build-size-url]: https://bundlephobia.com/result?p=d3-force-constant\n[npm-downloads-img]: https://img.shields.io/npm/dt/d3-force-constant\n[npm-downloads-url]: https://www.npmtrends.com/d3-force-constant\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvasturiano%2Fd3-force-constant","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvasturiano%2Fd3-force-constant","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvasturiano%2Fd3-force-constant/lists"}