{"id":15021310,"url":"https://github.com/lucamueller1/three-tween-path","last_synced_at":"2026-02-11T17:06:36.543Z","repository":{"id":37479490,"uuid":"376637746","full_name":"LucaMueller1/three-tween-path","owner":"LucaMueller1","description":"Uses TweenJs to create a Catmull-Rom curve to move a 3d object along. Can be used to pause between several paths.","archived":false,"fork":false,"pushed_at":"2021-07-01T21:58:22.000Z","size":24,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-12T17:09:31.120Z","etag":null,"topics":["catmull-rom","pathfinding","splines","threejs","tween","tweenjs"],"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/LucaMueller1.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}},"created_at":"2021-06-13T20:49:47.000Z","updated_at":"2024-11-30T16:53:17.000Z","dependencies_parsed_at":"2022-09-14T12:20:34.218Z","dependency_job_id":null,"html_url":"https://github.com/LucaMueller1/three-tween-path","commit_stats":null,"previous_names":["reignjs/three-tween-path"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LucaMueller1%2Fthree-tween-path","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LucaMueller1%2Fthree-tween-path/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LucaMueller1%2Fthree-tween-path/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LucaMueller1%2Fthree-tween-path/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LucaMueller1","download_url":"https://codeload.github.com/LucaMueller1/three-tween-path/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":233634083,"owners_count":18705952,"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":["catmull-rom","pathfinding","splines","threejs","tween","tweenjs"],"created_at":"2024-09-24T19:56:25.925Z","updated_at":"2025-09-20T05:33:26.074Z","avatar_url":"https://github.com/LucaMueller1.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Three Tween Path\n\nThis module uses TweenJs to create a smooth path (Catmull-Rom) through the given path data (includes vertices, duration and delay between segments).\n\nInstall using npm:\n```shell\nnpm i three-tween-path\n```\n\n## Usage\nImport the module and your path data\n```js\nimport * as THREE from \"three\";\nimport TWEEN from \"@tweenjs/tween.js\";\n\nimport * as TweenRoute from \"three-tween-path\";\nimport { samplePath } from './samplePath';\n```\n\nCreate a MultiTween with a given 3d object and the path data\n```js\nlet myTween = TweenRoute.MultiTweenPath(my3dObject, samplePath);\nmyTween.start();\n```\n\nRun the TweenJs update function to keep your tween updated\n```js\nconst animate = () =\u003e {\n  requestAnimationFrame(animate);\n  renderer.render(scene, camera);\n  \n  //update tween\n  TWEEN.update();\n};\n```\n\n### Callbacks\nUse callbacks according to the implementation in tweenjs. A callback can be implemented like this:\n```js\nconst onSegmentStart = () =\u003e {\n  //could be used to start a running animation or something similar\n  console.log(\"Segment start!\");\n}\n\nconst onSegmentEnd = () =\u003e {\n  //could stop the running animation and return to an idle animation\n  console.log(\"Segment end!\");\n}\n\nlet sampleTween = TweenRoute.MultiTweenPath(cone, samplePath, onSegmentStart, onSegmentEnd);\nsampleTween.start();\n```\nOne callback is run at the beginning of the segment and the other at the end of a segment. Use this to halt any animations or run different kind of tasks.\n\n## Path Data\nThe path data necessary for the module is in the following structure:\n```js\nconst pathData = [\n    {\n        path: [\n            {x: -40, y: 30, z: -17},\n            {x: -43, y: 29, z: -16},\n            {x: -42, y: 29, z: -15} //copy to next path for consistency\n        ],\n        delay: 2000,\n        duration: 5000\n    },\n    {\n        path: [\n            {x: -42, y: 29, z: -15}, //be sure to include the last vector of the previous path\n            {x: -41, y: 29.25, z: -15},\n            {x: -18, y: 28, z: -3}\n        ],\n        delay: 2000,\n        duration: 10000\n    },\n    {\n        path: [\n            {x: -18, y: 28, z: -3},\n            {x: -16.5, y: 28, z: -5},\n            {x: -6, y: 28, z: -6}\n        ],\n        delay: 1000,\n        duration: 8000\n    }\n]\n```\nAlways include the last vertices of the previous path in the subsequent path to avoid choppy transitions.\nThe duration and delay parameters are measured in milliseconds.\n\n## Example\nClone the repository and run\n```shell\nnpm i\nnpm start\n```\nThe example is available under localhost:3000\n![image](https://user-images.githubusercontent.com/64702286/121824172-76870980-ccaa-11eb-8b84-d53faf893dcf.png)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flucamueller1%2Fthree-tween-path","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flucamueller1%2Fthree-tween-path","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flucamueller1%2Fthree-tween-path/lists"}