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.1.1 to 1.1.2

2

index.js
const staticValues = require("./lib/static");
const funcList = require("./lib/functions");

@@ -6,3 +7,4 @@ const Easing = staticValues;

Easing.stream = require("./lib/stream");
Easing.uniqueList = funcList.uniqueList;
module.exports = exports = Easing;

@@ -19,6 +19,15 @@ const EventEmitter = require("events");

if (index >= list.length) {
clearInterval(id);
ee.emit("end");
if (options.repeat === false) {
clearInterval(id);
ee.emit("end");
} else {
ee.emit("repeat")
index = 0
}
}
}, intervalTime);
ee.on("requestStop", () => {
clearInterval(id);
ee.emit("end")
})
return ee;

@@ -25,0 +34,0 @@ };

4

lib/functions.js

@@ -29,6 +29,6 @@ const funclist = {};

funclist["circular"] = function(x) {
var time = Math.PI * 1.5 + x * (Math.PI / 2);
return 1 + Math.sin(time);
return 1 - Math.sqrt(1 - x*x)
};
funclist["uniqueList"] = ["linear", "quadratic", "cubic", "quartic", "quintic", "sinusoidal", "exponential", "circular"];
module.exports = exports = funclist;

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

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

@@ -8,0 +8,0 @@ "easing",

@@ -16,1 +16,17 @@ const Easing = require("../");

});
test("event - repeat and stop", function(t) {
t.plan(1);
const expected = [0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1];
const x = Easing.event(11, "linear", { repeat: true });
const list = [];
x.on("data", function(value) {
list.push(value);
});
x.on("repeat", function() {
x.emit("requestStop")
})
x.on("end", function() {
t.deepEqual(list, expected);
});
});
const Easing = require("../");
const test = require("tape");
test("uniqueList", function(t) {
t.plan(1);
const expected = [
"linear",
"quadratic",
"cubic",
"quartic",
"quintic",
"sinusoidal",
"exponential",
"circular"
];
t.deepEqual(Easing.uniqueList, expected);
});
test("end to end", function(t) {

@@ -135,11 +150,11 @@ t.plan(1);

0,
0.012,
0.048,
0.108,
0.19,
0.292,
0.412,
0.546,
0.69,
0.843,
0.005,
0.02,
0.046,
0.083,
0.133,
0.2,
0.285,
0.4,
0.564,
1

@@ -146,0 +161,0 @@ ];

Sorry, the diff of this file is not supported yet

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