0.0.3 • Published 4 years ago

duckling.js v0.0.3

Weekly downloads
2
License
MIT
Repository
github
Last release
4 years ago

Duckling

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