0.0.1 • Published 4 years ago
@mystroken/mouse-explorer v0.0.1
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)`;
});
0.0.1
4 years ago