Comparing version 2.0.0-rc.1 to 2.0.0
@@ -1,2 +0,2 @@ | ||
// https://d3js.org/d3-ease/ v2.0.0-rc.1 Copyright 2020 Mike Bostock | ||
// https://d3js.org/d3-ease/ v2.0.0 Copyright 2020 Mike Bostock | ||
(function (global, factory) { | ||
@@ -76,3 +76,3 @@ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : | ||
function sinIn(t) { | ||
return 1 - Math.cos(t * halfPi); | ||
return (+t === 1) ? 1 : 1 - Math.cos(t * halfPi); | ||
} | ||
@@ -88,12 +88,17 @@ | ||
// tpmt is two power minus ten times t scaled to [0,1] | ||
function tpmt(x) { | ||
return (Math.pow(2, -10 * x) - 0.0009765625) * 1.0009775171065494; | ||
} | ||
function expIn(t) { | ||
return Math.pow(2, 10 * t - 10); | ||
return tpmt(1 - +t); | ||
} | ||
function expOut(t) { | ||
return 1 - Math.pow(2, -10 * t); | ||
return 1 - tpmt(t); | ||
} | ||
function expInOut(t) { | ||
return ((t *= 2) <= 1 ? Math.pow(2, 10 * t - 10) : 2 - Math.pow(2, 10 - 10 * t)) / 2; | ||
return ((t *= 2) <= 1 ? tpmt(1 - t) : 2 - tpmt(t - 1)) / 2; | ||
} | ||
@@ -142,3 +147,3 @@ | ||
function backIn(t) { | ||
return t * t * ((s + 1) * t - s); | ||
return (t = +t) * t * (s * (t - 1) + t); | ||
} | ||
@@ -155,3 +160,3 @@ | ||
function backOut(t) { | ||
return --t * t * ((s + 1) * t + s) + 1; | ||
return --t * t * ((t + 1) * s + t) + 1; | ||
} | ||
@@ -184,3 +189,3 @@ | ||
function elasticIn(t) { | ||
return a * Math.pow(2, 10 * --t) * Math.sin((s - t) / p); | ||
return a * tpmt(-(--t)) * Math.sin((s - t) / p); | ||
} | ||
@@ -198,3 +203,3 @@ | ||
function elasticOut(t) { | ||
return 1 - a * Math.pow(2, -10 * (t = +t)) * Math.sin((t + s) / p); | ||
return 1 - a * tpmt(t = +t) * Math.sin((t + s) / p); | ||
} | ||
@@ -213,4 +218,4 @@ | ||
return ((t = t * 2 - 1) < 0 | ||
? a * Math.pow(2, 10 * t) * Math.sin((s - t) / p) | ||
: 2 - a * Math.pow(2, -10 * t) * Math.sin((s + t) / p)) / 2; | ||
? a * tpmt(-t) * Math.sin((s - t) / p) | ||
: 2 - a * tpmt(t) * Math.sin((s + t) / p)) / 2; | ||
} | ||
@@ -217,0 +222,0 @@ |
@@ -1,2 +0,2 @@ | ||
// https://d3js.org/d3-ease/ v2.0.0-rc.1 Copyright 2020 Mike Bostock | ||
!function(n,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((n=n||self).d3=n.d3||{})}(this,function(n){"use strict";function e(n){return((n*=2)<=1?n*n:--n*(2-n)+1)/2}function t(n){return((n*=2)<=1?n*n*n:(n-=2)*n*n+2)/2}var u=function n(e){function t(n){return Math.pow(n,e)}return e=+e,t.exponent=n,t}(3),r=function n(e){function t(n){return 1-Math.pow(1-n,e)}return e=+e,t.exponent=n,t}(3),a=function n(e){function t(n){return((n*=2)<=1?Math.pow(n,e):2-Math.pow(2-n,e))/2}return e=+e,t.exponent=n,t}(3),o=Math.PI,i=o/2;function c(n){return(1-Math.cos(o*n))/2}function s(n){return((n*=2)<=1?Math.pow(2,10*n-10):2-Math.pow(2,10-10*n))/2}function f(n){return((n*=2)<=1?1-Math.sqrt(1-n*n):Math.sqrt(1-(n-=2)*n)+1)/2}var h=4/11,p=6/11,M=8/11,d=.75,I=9/11,l=10/11,O=.9375,x=21/22,w=63/64,v=1/h/h;function m(n){return(n=+n)<h?v*n*n:n<M?v*(n-=p)*n+d:n<l?v*(n-=I)*n+O:v*(n-=x)*n+w}var y=function n(e){function t(n){return n*n*((e+1)*n-e)}return e=+e,t.overshoot=n,t}(1.70158),B=function n(e){function t(n){return--n*n*((e+1)*n+e)+1}return e=+e,t.overshoot=n,t}(1.70158),C=function n(e){function t(n){return((n*=2)<1?n*n*((e+1)*n-e):(n-=2)*n*((e+1)*n+e)+2)/2}return e=+e,t.overshoot=n,t}(1.70158),E=2*Math.PI,P=function n(e,t){var u=Math.asin(1/(e=Math.max(1,e)))*(t/=E);function r(n){return e*Math.pow(2,10*--n)*Math.sin((u-n)/t)}return r.amplitude=function(e){return n(e,t*E)},r.period=function(t){return n(e,t)},r}(1,.3),b=function n(e,t){var u=Math.asin(1/(e=Math.max(1,e)))*(t/=E);function r(n){return 1-e*Math.pow(2,-10*(n=+n))*Math.sin((n+u)/t)}return r.amplitude=function(e){return n(e,t*E)},r.period=function(t){return n(e,t)},r}(1,.3),k=function n(e,t){var u=Math.asin(1/(e=Math.max(1,e)))*(t/=E);function r(n){return((n=2*n-1)<0?e*Math.pow(2,10*n)*Math.sin((u-n)/t):2-e*Math.pow(2,-10*n)*Math.sin((u+n)/t))/2}return r.amplitude=function(e){return n(e,t*E)},r.period=function(t){return n(e,t)},r}(1,.3);n.easeBack=C,n.easeBackIn=y,n.easeBackInOut=C,n.easeBackOut=B,n.easeBounce=m,n.easeBounceIn=function(n){return 1-m(1-n)},n.easeBounceInOut=function(n){return((n*=2)<=1?1-m(1-n):m(n-1)+1)/2},n.easeBounceOut=m,n.easeCircle=f,n.easeCircleIn=function(n){return 1-Math.sqrt(1-n*n)},n.easeCircleInOut=f,n.easeCircleOut=function(n){return Math.sqrt(1- --n*n)},n.easeCubic=t,n.easeCubicIn=function(n){return n*n*n},n.easeCubicInOut=t,n.easeCubicOut=function(n){return--n*n*n+1},n.easeElastic=b,n.easeElasticIn=P,n.easeElasticInOut=k,n.easeElasticOut=b,n.easeExp=s,n.easeExpIn=function(n){return Math.pow(2,10*n-10)},n.easeExpInOut=s,n.easeExpOut=function(n){return 1-Math.pow(2,-10*n)},n.easeLinear=n=>+n,n.easePoly=a,n.easePolyIn=u,n.easePolyInOut=a,n.easePolyOut=r,n.easeQuad=e,n.easeQuadIn=function(n){return n*n},n.easeQuadInOut=e,n.easeQuadOut=function(n){return n*(2-n)},n.easeSin=c,n.easeSinIn=function(n){return 1-Math.cos(n*i)},n.easeSinInOut=c,n.easeSinOut=function(n){return Math.sin(n*i)},Object.defineProperty(n,"__esModule",{value:!0})}); | ||
// https://d3js.org/d3-ease/ v2.0.0 Copyright 2020 Mike Bostock | ||
!function(n,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((n=n||self).d3=n.d3||{})}(this,function(n){"use strict";function e(n){return((n*=2)<=1?n*n:--n*(2-n)+1)/2}function t(n){return((n*=2)<=1?n*n*n:(n-=2)*n*n+2)/2}var u=function n(e){function t(n){return Math.pow(n,e)}return e=+e,t.exponent=n,t}(3),r=function n(e){function t(n){return 1-Math.pow(1-n,e)}return e=+e,t.exponent=n,t}(3),a=function n(e){function t(n){return((n*=2)<=1?Math.pow(n,e):2-Math.pow(2-n,e))/2}return e=+e,t.exponent=n,t}(3),o=Math.PI,i=o/2;function c(n){return(1-Math.cos(o*n))/2}function s(n){return 1.0009775171065494*(Math.pow(2,-10*n)-.0009765625)}function f(n){return((n*=2)<=1?s(1-n):2-s(n-1))/2}function h(n){return((n*=2)<=1?1-Math.sqrt(1-n*n):Math.sqrt(1-(n-=2)*n)+1)/2}var p=4/11,M=6/11,d=8/11,I=.75,l=9/11,O=10/11,x=.9375,v=21/22,m=63/64,y=1/p/p;function B(n){return(n=+n)<p?y*n*n:n<d?y*(n-=M)*n+I:n<O?y*(n-=l)*n+x:y*(n-=v)*n+m}var C=function n(e){function t(n){return(n=+n)*n*(e*(n-1)+n)}return e=+e,t.overshoot=n,t}(1.70158),E=function n(e){function t(n){return--n*n*((n+1)*e+n)+1}return e=+e,t.overshoot=n,t}(1.70158),P=function n(e){function t(n){return((n*=2)<1?n*n*((e+1)*n-e):(n-=2)*n*((e+1)*n+e)+2)/2}return e=+e,t.overshoot=n,t}(1.70158),b=2*Math.PI,w=function n(e,t){var u=Math.asin(1/(e=Math.max(1,e)))*(t/=b);function r(n){return e*s(- --n)*Math.sin((u-n)/t)}return r.amplitude=function(e){return n(e,t*b)},r.period=function(t){return n(e,t)},r}(1,.3),k=function n(e,t){var u=Math.asin(1/(e=Math.max(1,e)))*(t/=b);function r(n){return 1-e*s(n=+n)*Math.sin((n+u)/t)}return r.amplitude=function(e){return n(e,t*b)},r.period=function(t){return n(e,t)},r}(1,.3),q=function n(e,t){var u=Math.asin(1/(e=Math.max(1,e)))*(t/=b);function r(n){return((n=2*n-1)<0?e*s(-n)*Math.sin((u-n)/t):2-e*s(n)*Math.sin((u+n)/t))/2}return r.amplitude=function(e){return n(e,t*b)},r.period=function(t){return n(e,t)},r}(1,.3);n.easeBack=P,n.easeBackIn=C,n.easeBackInOut=P,n.easeBackOut=E,n.easeBounce=B,n.easeBounceIn=function(n){return 1-B(1-n)},n.easeBounceInOut=function(n){return((n*=2)<=1?1-B(1-n):B(n-1)+1)/2},n.easeBounceOut=B,n.easeCircle=h,n.easeCircleIn=function(n){return 1-Math.sqrt(1-n*n)},n.easeCircleInOut=h,n.easeCircleOut=function(n){return Math.sqrt(1- --n*n)},n.easeCubic=t,n.easeCubicIn=function(n){return n*n*n},n.easeCubicInOut=t,n.easeCubicOut=function(n){return--n*n*n+1},n.easeElastic=k,n.easeElasticIn=w,n.easeElasticInOut=q,n.easeElasticOut=k,n.easeExp=f,n.easeExpIn=function(n){return s(1-+n)},n.easeExpInOut=f,n.easeExpOut=function(n){return 1-s(n)},n.easeLinear=n=>+n,n.easePoly=a,n.easePolyIn=u,n.easePolyInOut=a,n.easePolyOut=r,n.easeQuad=e,n.easeQuadIn=function(n){return n*n},n.easeQuadInOut=e,n.easeQuadOut=function(n){return n*(2-n)},n.easeSin=c,n.easeSinIn=function(n){return 1==+n?1:1-Math.cos(n*i)},n.easeSinInOut=c,n.easeSinOut=function(n){return Math.sin(n*i)},Object.defineProperty(n,"__esModule",{value:!0})}); |
{ | ||
"name": "d3-ease", | ||
"version": "2.0.0-rc.1", | ||
"publishConfig": { | ||
"tag": "next" | ||
}, | ||
"version": "2.0.0", | ||
"description": "Easing functions for smooth animation.", | ||
@@ -8,0 +5,0 @@ "keywords": [ |
@@ -7,3 +7,3 @@ var overshoot = 1.70158; | ||
function backIn(t) { | ||
return t * t * ((s + 1) * t - s); | ||
return (t = +t) * t * (s * (t - 1) + t); | ||
} | ||
@@ -20,3 +20,3 @@ | ||
function backOut(t) { | ||
return --t * t * ((s + 1) * t + s) + 1; | ||
return --t * t * ((t + 1) * s + t) + 1; | ||
} | ||
@@ -23,0 +23,0 @@ |
@@ -0,1 +1,3 @@ | ||
import {tpmt} from "./math.js"; | ||
var tau = 2 * Math.PI, | ||
@@ -9,3 +11,3 @@ amplitude = 1, | ||
function elasticIn(t) { | ||
return a * Math.pow(2, 10 * --t) * Math.sin((s - t) / p); | ||
return a * tpmt(-(--t)) * Math.sin((s - t) / p); | ||
} | ||
@@ -23,3 +25,3 @@ | ||
function elasticOut(t) { | ||
return 1 - a * Math.pow(2, -10 * (t = +t)) * Math.sin((t + s) / p); | ||
return 1 - a * tpmt(t = +t) * Math.sin((t + s) / p); | ||
} | ||
@@ -38,4 +40,4 @@ | ||
return ((t = t * 2 - 1) < 0 | ||
? a * Math.pow(2, 10 * t) * Math.sin((s - t) / p) | ||
: 2 - a * Math.pow(2, -10 * t) * Math.sin((s + t) / p)) / 2; | ||
? a * tpmt(-t) * Math.sin((s - t) / p) | ||
: 2 - a * tpmt(t) * Math.sin((s + t) / p)) / 2; | ||
} | ||
@@ -42,0 +44,0 @@ |
@@ -0,11 +1,13 @@ | ||
import {tpmt} from "./math.js"; | ||
export function expIn(t) { | ||
return Math.pow(2, 10 * t - 10); | ||
return tpmt(1 - +t); | ||
} | ||
export function expOut(t) { | ||
return 1 - Math.pow(2, -10 * t); | ||
return 1 - tpmt(t); | ||
} | ||
export function expInOut(t) { | ||
return ((t *= 2) <= 1 ? Math.pow(2, 10 * t - 10) : 2 - Math.pow(2, 10 - 10 * t)) / 2; | ||
return ((t *= 2) <= 1 ? tpmt(1 - t) : 2 - tpmt(t - 1)) / 2; | ||
} |
@@ -5,3 +5,3 @@ var pi = Math.PI, | ||
export function sinIn(t) { | ||
return 1 - Math.cos(t * halfPi); | ||
return (+t === 1) ? 1 : 1 - Math.cos(t * halfPi); | ||
} | ||
@@ -8,0 +8,0 @@ |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
34353
17
423
0
0