Comparing version 1.0.0 to 1.1.1
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 |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
66869
22
829
133
0
6