Comparing version 0.1.1 to 0.2.0
@@ -5,45 +5,45 @@ "use strict"; | ||
// No easing, no acceleration | ||
linear: (t) => t, | ||
linear: function (t) { return t; }, | ||
// Accelerates fast, then slows quickly towards end. | ||
quadratic: (t) => t * (-(t * t) * t + 4 * t * t - 6 * t + 4), | ||
quadratic: function (t) { return t * (-(t * t) * t + 4 * t * t - 6 * t + 4); }, | ||
// Overshoots over 1 and then returns to 1 towards end. | ||
cubic: (t) => t * (4 * t * t - 9 * t + 6), | ||
cubic: function (t) { return t * (4 * t * t - 9 * t + 6); }, | ||
// Overshoots over 1 multiple times - wiggles around 1. | ||
elastic: (t) => t * (33 * t * t * t * t - 106 * t * t * t + 126 * t * t - 67 * t + 15), | ||
elastic: function (t) { return t * (33 * t * t * t * t - 106 * t * t * t + 126 * t * t - 67 * t + 15); }, | ||
// Accelerating from zero velocity | ||
inQuad: (t) => t * t, | ||
inQuad: function (t) { return t * t; }, | ||
// Decelerating to zero velocity | ||
outQuad: (t) => t * (2 - t), | ||
outQuad: function (t) { return t * (2 - t); }, | ||
// Acceleration until halfway, then deceleration | ||
inOutQuad: (t) => t < .5 ? 2 * t * t : -1 + (4 - 2 * t) * t, | ||
inOutQuad: function (t) { return t < .5 ? 2 * t * t : -1 + (4 - 2 * t) * t; }, | ||
// Accelerating from zero velocity | ||
inCubic: (t) => t * t * t, | ||
inCubic: function (t) { return t * t * t; }, | ||
// Decelerating to zero velocity | ||
outCubic: (t) => (--t) * t * t + 1, | ||
outCubic: function (t) { return (--t) * t * t + 1; }, | ||
// Acceleration until halfway, then deceleration | ||
inOutCubic: (t) => t < .5 ? 4 * t * t * t : (t - 1) * (2 * t - 2) * (2 * t - 2) + 1, | ||
inOutCubic: function (t) { return t < .5 ? 4 * t * t * t : (t - 1) * (2 * t - 2) * (2 * t - 2) + 1; }, | ||
// Accelerating from zero velocity | ||
inQuart: (t) => t * t * t * t, | ||
inQuart: function (t) { return t * t * t * t; }, | ||
// Decelerating to zero velocity | ||
outQuart: (t) => 1 - (--t) * t * t * t, | ||
outQuart: function (t) { return 1 - (--t) * t * t * t; }, | ||
// Acceleration until halfway, then deceleration | ||
inOutQuart: (t) => t < .5 ? 8 * t * t * t * t : 1 - 8 * (--t) * t * t * t, | ||
inOutQuart: function (t) { return t < .5 ? 8 * t * t * t * t : 1 - 8 * (--t) * t * t * t; }, | ||
// Accelerating from zero velocity | ||
inQuint: (t) => t * t * t * t * t, | ||
inQuint: function (t) { return t * t * t * t * t; }, | ||
// Decelerating to zero velocity | ||
outQuint: (t) => 1 + (--t) * t * t * t * t, | ||
outQuint: function (t) { return 1 + (--t) * t * t * t * t; }, | ||
// Acceleration until halfway, then deceleration | ||
inOutQuint: (t) => t < .5 ? 16 * t * t * t * t * t : 1 + 16 * (--t) * t * t * t * t, | ||
inOutQuint: function (t) { return t < .5 ? 16 * t * t * t * t * t : 1 + 16 * (--t) * t * t * t * t; }, | ||
// Accelerating from zero velocity | ||
inSine: (t) => -Math.cos(t * (Math.PI / 2)) + 1, | ||
inSine: function (t) { return -Math.cos(t * (Math.PI / 2)) + 1; }, | ||
// Decelerating to zero velocity | ||
outSine: (t) => Math.sin(t * (Math.PI / 2)), | ||
outSine: function (t) { return Math.sin(t * (Math.PI / 2)); }, | ||
// Accelerating until halfway, then decelerating | ||
inOutSine: (t) => -(Math.cos(Math.PI * t) - 1) / 2, | ||
inOutSine: function (t) { return -(Math.cos(Math.PI * t) - 1) / 2; }, | ||
// Exponential accelerating from zero velocity | ||
inExpo: (t) => Math.pow(2, 10 * (t - 1)), | ||
inExpo: function (t) { return Math.pow(2, 10 * (t - 1)); }, | ||
// Exponential decelerating to zero velocity | ||
outExpo: (t) => -Math.pow(2, -10 * t) + 1, | ||
outExpo: function (t) { return -Math.pow(2, -10 * t) + 1; }, | ||
// Exponential accelerating until halfway, then decelerating | ||
inOutExpo: (t) => { | ||
inOutExpo: function (t) { | ||
t /= .5; | ||
@@ -56,3 +56,3 @@ if (t < 1) | ||
// Circular accelerating from zero velocity | ||
inCirc: (t) => -Math.sqrt(1 - t * t) + 1, | ||
inCirc: function (t) { return -Math.sqrt(1 - t * t) + 1; }, | ||
// Circular decelerating to zero velocity Moves VERY fast at the beginning and | ||
@@ -62,5 +62,5 @@ // then quickly slows down in the middle. This tween can actually be used | ||
// because of the very quick start, it hides the jitter between target value changes. | ||
outCirc: (t) => Math.sqrt(1 - (t = t - 1) * t), | ||
outCirc: function (t) { return Math.sqrt(1 - (t = t - 1) * t); }, | ||
// Circular acceleration until halfway, then deceleration | ||
inOutCirc: (t) => { | ||
inOutCirc: function (t) { | ||
t /= .5; | ||
@@ -67,0 +67,0 @@ if (t < 1) |
{ | ||
"name": "ts-easing", | ||
"version": "0.1.1", | ||
"version": "0.2.0", | ||
"description": "Collection of easing functions in TypeScript", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -17,4 +17,13 @@ # ts-easing | ||
## Usage | ||
```js | ||
import {easing} from 'ts-easing'; | ||
console.log(easing.quadratic(0.5)); | ||
``` | ||
## License | ||
[Unlicense](./LICENSE) — public domain. |
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
6524
29