1.1.3 • Published 4 years ago

impulsion v1.1.3

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

Impulsion.js

npm version

Fork of the excellent impetus.js by Chris Bateman.

Adds new features such as:

  • Exposes previousX and previousY to our lifecycle events.
  • Adds more lifecycle events:
    • onStart: Called when starting to drag the element.
    • onStartDecelerating: Called when the deceleration begun.
    • onEndDecelerating: called when the deceleration has ended.

As well other bugfixes and minor features.

Add momentum to anything. It's like iScroll, except not for scrolling. Supports mouse and touch events.

Check out the demos on the home page.

Impulsion will probably never support anything other than simple momentum. If you need scrolling or touch carousels or anything like that, this probably isn't the tool you're looking for.

Installation

yarn add impulsion
# or npm install impulsion

Usage

import Impulsion from 'impulsion';
// const Impulsion = require('impulsion');

let myImpulsion = new Impulsion({
    source: myNode,
    onUpdate(x, y, previousX, previousY) {
        // whatever you want to do with the values
    }
});

You give it an area to listen to for touch or mouse events, and it gives you the x and y values with some momentum.

Impulsion will register itself as an AMD module if it's available.

Constructor Options

Methods

Browser Support

Chrome, Firefox, Safari, Opera, IE 9+, iOS, Android. Support for IE 8 can be achieved by adding a polyfill for addEventListener.

1.1.3

4 years ago

1.1.2

4 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago

0.12.0

4 years ago

0.11.0

4 years ago