![require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages](https://cdn.sanity.io/images/cgdhsj6q/production/be8ab80c8efa5907bc341c6fefe9aa20d239d890-1600x1097.png?w=400&fit=max&auto=format)
Security News
require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
react-drifting-component
Advanced tools
The drifting component which allows you to drift on the screen :) The component uses mousemove event for desktops and deviceorientation for mobile devices.
$ npm install react-drifting-component
import { Drifting } from 'react-drifting-component';
// Inside of a component's render() method:
render() {
return (
<Wrapper>
<Drifting maxMouseRange={15} maxOrientationRange={15}>
{({ ref }) => <Background ref={ref} />}
</Drifting>
<Drifting maxMouseRange={50} maxOrientationRange={20} reverse>
{
({ pos, onRef }) =>
<Text ref={ref} text="Drifting component" className="title" />
}
</Drifting>
</Wrapper>
);
}
Please clone the repo and run npm run storybook
or yarn storybook
to show examples of usages.
The Drifting
component has a few properties, as described below.
NOTE: this component uses rAF(requestAnimationFrame) if you need to support old browsers ensure that you are using polyfill for rAF!
Property | Type | Defaut | Description |
---|---|---|---|
reverse | boolean | false | Reverse drifting |
children | function | ({ pos: { x, y } }, onRef: () => 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 |
maxMouseRange | number | null | Max mouse drift range. |
maxOrientationRange | number | maxMouseRange | Max orientation drift range. devices. |
I welcome contributions! Please open an issue if you have any feature ideas or find any bugs. I also accept pull requests with open arms. I will go over the issues when I have time. :)
FAQs
Drifting react component
We found that react-drifting-component demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.