Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rook2pawn/node-easing
https://rook2pawn.github.io/node-easing easing functions without the unnecessary framework cruft
https://github.com/rook2pawn/node-easing
Last synced: 3 months ago
JSON representation
https://rook2pawn.github.io/node-easing easing functions without the unnecessary framework cruft
- Host: GitHub
- URL: https://github.com/rook2pawn/node-easing
- Owner: rook2pawn
- Created: 2011-11-11T14:07:17.000Z (about 13 years ago)
- Default Branch: master
- Last Pushed: 2019-03-28T12:12:43.000Z (over 5 years ago)
- Last Synced: 2024-07-19T15:48:00.571Z (4 months ago)
- Language: JavaScript
- Homepage:
- Size: 1.15 MB
- Stars: 32
- Watchers: 3
- Forks: 5
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
| testing | coverage |
| ------- | ---------|
| [![Build Status](https://travis-ci.org/rook2pawn/node-easing.svg?branch=master)](https://travis-ci.org/rook2pawn/node-easing) | [![Coverage Status](https://coveralls.io/repos/github/rook2pawn/node-easing/badge.svg?branch=master)](https://coveralls.io/github/rook2pawn/node-easing?branch=master) |![easing](https://github.com/rook2pawn/node-easing/raw/master/graph.png)
# easing
```js
const Easing = require('easing')const x = Easing(11,'linear')
// [ 0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1 ]const y = Easing(11,'quadratic')
// [ 0, 0.01, 0.04, 0.09, 0.16, 0.25, 0.36, 0.49, 0.64, 0.81, 1 ]
```## install
npm install --save easing
## On the client
### drop it in
Simply include `browser-easing.js` and you can directly use the Easing function globally
```html
var x = Easing(11,'cubic');
console.log(x)
```### or with browserify
const Easing = require('easing')
## Types of Easing
### Linear
For an array of 42 values that are linear,
Easing(42,'linear')
### Quadratic
For an array of 100 values that are quadratic,
Easing(100,'quadratic')
### Cubic
For an array of 42 cubic values,
Easing(42,'cubic')
### Quartic
For an array of 1492 quartic values,
Easing(1492,'quartic')
### Quintic
Easing(25,'quintic')
### Sinusoidal
Easing(333,'sinusoidal')
Easing(333,'sin')### Circular
Easing(314,'circular')
### Exponential
Easing(81,'exponential')
## options
### endToEnd
If we wanted to go from 0 to 1 back to 0 quadratically, simply call
Easing(100,'quadratic',{endToEnd:true});
### invert
If we want to go from 1 to 0 (or 1 to 0 back to 1) instead of 0 to 1, say 'linear' style, simply call
Easing(100,'linear',{invert:true});
You can mix and match these options.
## additional interfaces
### Event interface
```js
const Easing = require('easing')
const x = Easing.event(11,'linear')
x.on('data', (data) => { ... })
```### Stream interface
```js
const Easing = require('easing')
const x = Easing.stream(11,'linear')
x.pipe(process.stdout)
```These two interfaces have their own options `duration` and `repeat` that you can also mix and match.
These two interfaces can take one or all of these options
* invert : boolean
* endToEnd : boolean
* duration : integer (milliseconds, defaults to 1000)
* repeat : boolean (default false)## LICENSE
MIT