1.0.2 • Published 2 years ago

100janovic-mousemover v1.0.2

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

MouseMover

Small library for mouse move animation. It can be used for creating parallax effects.

Installation

npm install --save 100janovic-mousemover

Import

import { MouseMover } from '100janovic-mousemover';

Usage

// set element
let background = {
    element: document.getElementById("background"), 
    translation: {x: -20, y: -15}, scale:{x: 1.05, y: 1.05}
};
// init
this.mouseMover = new MouseMover([ // array of elements
    background
], {
    moveSpeed: 0.8, // animation speed in seconds
    debug: false, // print console log message for debuging
    debounce: 10 // debounce time fore mouse move event
});

Destroy

Important to destroy after you don't need it anymore, otherwise mouse move events will still be active.

this.mouseMover.destroy();

Based on article from tympanus.net/codrops

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago