float-js

0.2.4 • Public • Published

Float.js

A tiny (0.78kb gzipped), requestAnimationFrame powered, 60+fps decelerated parallax layer offsetting engine that reacts to the mouse position or device orientation.

Usage and Options

<div data-float='0.5'>
import FloatJS from 'float-js';
 
const float = new FloatJS({
  'attribute': 'data-float', // Defines attribute selector.
  'deceleration':       0.5, // Defines animation deceleration rate.
  'strength':           0.5, // Defines how much layers are offset.
  'precision':            1, // Decimal points for transform values.
  'direction':           -1  // 1 = linear, -1 = natural / inverted.
});

NPM

Available on npm: https://www.npmjs.com/package/float-js

License

MIT License

Readme

Keywords

none

Package Sidebar

Install

npm i float-js

Weekly Downloads

2

Version

0.2.4

License

MIT

Unpacked Size

6.65 kB

Total Files

4

Last publish

Collaborators

  • markoradak