{"id":13553376,"url":"https://github.com/munrocket/parallax-effect","last_synced_at":"2025-04-06T01:06:21.771Z","repository":{"id":57318788,"uuid":"259103958","full_name":"munrocket/parallax-effect","owner":"munrocket","description":"💫 Parallax effect in javascript using face tracking. An immersive view in 3d with webcam.","archived":false,"fork":false,"pushed_at":"2022-09-28T10:00:03.000Z","size":15866,"stargazers_count":358,"open_issues_count":2,"forks_count":16,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-30T00:07:08.012Z","etag":null,"topics":["camera","deepview","parallax","tfjs"],"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/munrocket.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":"2020-04-26T18:28:56.000Z","updated_at":"2025-03-20T20:48:54.000Z","dependencies_parsed_at":"2022-08-25T22:42:06.392Z","dependency_job_id":null,"html_url":"https://github.com/munrocket/parallax-effect","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/munrocket%2Fparallax-effect","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/munrocket%2Fparallax-effect/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/munrocket%2Fparallax-effect/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/munrocket%2Fparallax-effect/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/munrocket","download_url":"https://codeload.github.com/munrocket/parallax-effect/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247419859,"owners_count":20936012,"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":["camera","deepview","parallax","tfjs"],"created_at":"2024-08-01T12:02:23.193Z","updated_at":"2025-04-06T01:06:21.756Z","avatar_url":"https://github.com/munrocket.png","language":"JavaScript","readme":"# parallax-effect [![bundlephobia](https://badgen.net/bundlephobia/minzip/parallax-effect)](https://bundlephobia.com/result?p=parallax-effect)\n\nParallax effect in javascript using face tracking, can be a good improvement for 3d scenes. This library uses TFJS with WASM backend on CPU, so your GPU will be free. Supports lazy loading.\n\nInspired by [@lucknknock](https://twitter.com/lucknknock) C# demo\n\n### Live examples\n* [deepview](https://munrocket.github.io/parallax-effect/examples/deepview.html)\n* [pixi.js](https://munrocket.github.io/parallax-effect/examples/pixi.html)\n* [three.js](https://munrocket.github.io/parallax-effect/examples/threejs.html)\n\n![](https://habrastorage.org/webt/rj/65/g9/rj65g9_jtm2rgljgmk6yu5sjf6k.jpeg)\n\n### Installation\n\nRun `npm install parallax-effect` and import it as ES module\n```js\n  import * as Parallax from '../dist/parallax-effect.mjs';\n  Parallax.init( view =\u003e {\n    console.log( view );\n  } );\n```\nor add it in script tag\n```js\n  \u003cscript src=\"https://cdn.jsdelivr.net/npm/parallax-effect/dist/parallax-effect.min.js\"\u003e\u003c/script\u003e\n  \u003cscript\u003e\n    Parallax.init( view =\u003e {\n      console.log( view );\n    } );\n  \u003c/script\u003e\n```\n\n### Usage\n*View* in code below is a 3d vector with components similar to spherical coordinates: x/y in range [-1, 1] and proportional to angle, z is proportional to distance from camera to head. Also you can check for successfull init or change default settings: smoothing, default distance between eyes to change z, threshold in blazeface model or change tfjs source links from jsdelivr to unpkg / own server.\n```js\nParallax.init(\n  view =\u003e {\n    console.log( view.x, view.y, view.z );\n  }, {\n    smoothEye: 0.8, // smoothing eye (x, y)\n    smoothDist: 0.25, // smoothing distance (z)\n    defautDist: 0.12, // parameter for distance estimation\n    threshold = 0.85 // blazeface detection probability\n  }\n).then( rafId =\u003e {\n  console.log( 'cancelAnimationFrame(' + rafId + ')' );\n}).catch( errorMessage =\u003e {\n  console.log( errorMessage );\n} );\n```\n\n### Roadmap\n\n- [x] smoothing head detection with EMA\n- [x] support for iOS/Macs\n- [x] lazy load for tfjs\n- [x] three.js/pixi.js examples\n- [x] mouse fallback\n- [x] fix head rotation but not commit it in main branch yet\n- [ ] gyroscope fallback\n\n### Contribution\n\nFeel free to make issues or/and contribute.\n","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmunrocket%2Fparallax-effect","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmunrocket%2Fparallax-effect","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmunrocket%2Fparallax-effect/lists"}