0.0.1 • Published 4 years ago

@mystroken/mouse-explorer v0.0.1

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

mouse-explorer

contributions welcome

: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)`;
});