{"id":22731648,"url":"https://github.com/z4o4z/react-drifting-component","last_synced_at":"2025-07-04T02:34:55.771Z","repository":{"id":143905118,"uuid":"65489581","full_name":"z4o4z/react-drifting-component","owner":"z4o4z","description":"Allow your component drift on the screen","archived":false,"fork":false,"pushed_at":"2024-02-20T16:10:25.000Z","size":18770,"stargazers_count":11,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-04-24T16:58:44.082Z","etag":null,"topics":["component","drift","js","react","reactjs"],"latest_commit_sha":null,"homepage":"https://z4o4z.github.io/react-drifting-component/storybook-static/index.html","language":"TypeScript","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/z4o4z.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":"2016-08-11T17:45:57.000Z","updated_at":"2024-02-20T15:58:20.000Z","dependencies_parsed_at":null,"dependency_job_id":"4ddb1c15-446c-48ef-8513-8b87f36cc908","html_url":"https://github.com/z4o4z/react-drifting-component","commit_stats":null,"previous_names":["z4o4z/react-floating"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/z4o4z%2Freact-drifting-component","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/z4o4z%2Freact-drifting-component/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/z4o4z%2Freact-drifting-component/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/z4o4z%2Freact-drifting-component/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/z4o4z","download_url":"https://codeload.github.com/z4o4z/react-drifting-component/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248804721,"owners_count":21164127,"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":["component","drift","js","react","reactjs"],"created_at":"2024-12-10T19:29:37.942Z","updated_at":"2025-04-14T00:43:24.761Z","avatar_url":"https://github.com/z4o4z.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![](https://img.shields.io/npm/dm/react-drifting-component.svg?style=flat-square)](https://www.npmjs.com/package/react-drifting-component)\n\n# react-drifting-component\n\nThe drifting component which allows you to drift on the screen :) The component uses mousemove event for desktops and deviceorientation for mobile devices.\n\n## Installation\n\n```\n$ npm install react-drifting-component\n```\n\n## Demo\n\n[Try it out](https://z4o4z.github.io/react-drifting-component/)\n\n![](./demo/demo.gif)\n\n## Basic Usage\n\n```js\nimport { Drifting } from 'react-drifting-component';\n\n// Inside of a component's render() method:\nrender() {\n  return (\n    \u003cWrapper\u003e\n      \u003cDrifting maxMouseRange={15} maxOrientationRange={15}\u003e\n        {({ ref }) =\u003e \u003cBackground ref={ref} /\u003e}\n      \u003c/Drifting\u003e\n\n      \u003cDrifting maxMouseRange={50} maxOrientationRange={20} reverse\u003e\n        {\n          ({ pos, onRef }) =\u003e\n            \u003cText ref={ref} text=\"Drifting component\" className=\"title\" /\u003e\n        }\n      \u003c/Drifting\u003e\n    \u003c/Wrapper\u003e\n  );\n}\n```\n\n## Examples\n\nPlease clone the repo and run `npm run storybook` or `yarn storybook` to show examples of usages.\n\n## Usage (API)\n\nThe `Drifting` component has a few properties, as described below.\n\n\u003e NOTE: this component uses rAF(requestAnimationFrame) if you need to support old browsers ensure that you are using polyfill for rAF!\n\n| Property              | Type       | Defaut                                  | Description                                                                                                                                                                                                                                                    |\n| --------------------- | ---------- | --------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `reverse`             | `boolean`  | `false`                                 | Reverse drifting                                                                                                                                                                                                                                               |\n| `children`            | `function` | `({ pos: { x, y } }, onRef: () =\u003e ref)` | A function that gets an object with `pos` and `onRef` keys as an argument. Pos contains `x: number` and `y: number`, this numbers should pass to your component style to allow drift. `onRef` it is function which should be passed to `ref` of your component |\n| `maxMouseRange`       | `number`   | `null`                                  | Max mouse drift range.                                                                                                                                                                                                                                         |\n| `maxOrientationRange` | `number`   | `maxMouseRange`                         | Max orientation drift range. devices.                                                                                                                                                                                                                          |\n\n## Contributing\n\nI welcome contributions! Please open an issue if you have any feature ideas\nor find any bugs. I also accept pull requests with open arms. I will\ngo over the issues when I have time. :)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fz4o4z%2Freact-drifting-component","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fz4o4z%2Freact-drifting-component","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fz4o4z%2Freact-drifting-component/lists"}