duckling.js
v0.0.3
Published
Full js cursor follower, like ducklings to the mother duck
Downloads
2
Readme
duckling
JS cursor followe for websites
## How to use
Install the depencencies
yarn add duckling
or
npm install --save duckling
Add to your project
Import in your project
import {usePointer, helper} from 'duckling';
Initialize
const {initialProperties, interactionConfig} = usePointer();
Generate the interactions
interactionConfig.set('.nav-item', (elem) => {
const coordinates = elem.getBoundingClientRect();
return {
props: {
pointerSize: helper.px(parseInt(initialProperties.pointerSize) / 2),
pointerX: helper.px(coordinates.left + coordinates.width / 2),
pointerY: helper.px(coordinates.top + coordinates.height + 10),
},
track: false,
};
});
interactionConfig
is a Map class from js sou you can interact with it with methods like set
or delete