@mystroken/mouse-explorer
v0.0.1
Published
Browse along a section clipped into a viewport using a mouse.
Downloads
4
Maintainers
Readme
mouse-explorer
:mouse2: Browse along a section clipped into a viewport using a mouse.
Installation
npm install @mystroken/mouse-explorer
Usage
Look at the sources files for more information.
import createMouseExplorer from '@mystroken/mouse-explorer';
const viewport = document.querySelector('#viewport');
const section = document.querySelector('#container');
const explorer = createMouseExplorer({ viewport, section });
explorer.on(({ x, y }) => {
section.style.transform = `translate3d(${x},${y},0)`;
});