Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

easing

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

easing - npm Package Compare versions

Comparing version 1.0.0 to 1.1.1

lib/event.js

40

index.js

@@ -1,39 +0,7 @@

const funclist = require("./lib/functions");
const staticValues = require("./lib/static");
const round = function (val) {
return (~~(val * 1000) / 1000)
}
const Easing = staticValues;
Easing.event = require("./lib/event");
Easing.stream = require("./lib/stream");
const Easing = function(number, type, options = {}) {
const list = new Array(number);
const step = 1 / (list.length - 1);
for (var i = 1; i < list.length - 1; i++) {
let val = round(funclist[type](i * step));
list[i] = val;
}
list[0] = 0;
list[list.length - 1] = 1;
if (options.endToEnd) {
var mid = Math.floor(list.length / 2);
for (var i = 1; i < mid; i++) {
list[i] = list[i * 2];
}
list[mid] = 1;
for (var i = mid + 1; i < list.length - 1; i++) {
list[i] = list[mid - (i - mid)];
}
list[list.length - 1] = 0;
}
if (options.invert) {
for (var i = 0; i < list.length; i++) {
list[i] = 1 - list[i];
}
}
return list;
};
module.exports = exports = Easing;

@@ -5,3 +5,3 @@ {

"description": "Easing Functions Without the Framework Cruft",
"version": "1.0.0",
"version": "1.1.1",
"keywords": [

@@ -14,3 +14,3 @@ "easing",

"build-browser-standalone": "browserify -s Easing index.js -o browser-easing.js",
"test": "nyc node test/*.js | tap-spec",
"test": "nyc tape test/*.js | tap-spec",
"coverage": "nyc report --reporter=text-lcov | coveralls"

@@ -30,4 +30,5 @@ },

"tap-spec": "^4.1.1",
"tape": "^4.9.0"
"tape": "^4.9.0",
"through2": "^2.0.3"
}
}

@@ -104,5 +104,30 @@ | testing | coverage |

## 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
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc