inertia-3d

1.0.2 • Public • Published

inertia-3d

Drag DOM elements with simulated inertia, by 3D CSS transformations. Made using Zbam.js.

Example

Usage

import Inertia from "inertia-3d";
 
let cube = document.querySelector(".cube");
new Inertia(cube);

API

Used as

new Inertia(element);

or

new Inertia({
  element, // (HTMLElement) target element to be moved 
  handle, // (HTMLElement) target element to be used as the handle (Default: same as handle)
  positionDamping, // (Number) Damping for position (Default: 0.4)
  rotationDamping, // (Number) Damping for rotation (Default: 0.1)
  rotationMaxDegree, // (Number) Upper threshold for rotation (Unit: deg) (Default: 75)
  rotationMultiplier, // (Number) A factor for setting rotation amplitude when the element is moved (Default: 3)
});

Readme

Keywords

Package Sidebar

Install

npm i inertia-3d

Weekly Downloads

0

Version

1.0.2

License

ISC

Unpacked Size

498 kB

Total Files

19

Last publish

Collaborators

  • onurkerimov