Comparing version 1.0.6 to 1.0.7
@@ -1,2 +0,2 @@ | ||
// https://d3js.org/d3-ease/ v1.0.6 Copyright 2019 Mike Bostock | ||
// https://d3js.org/d3-ease/ v1.0.7 Copyright 2020 Mike Bostock | ||
(function (global, factory) { | ||
@@ -78,3 +78,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); | ||
} | ||
@@ -90,12 +90,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; | ||
} | ||
@@ -144,3 +149,3 @@ | ||
function backIn(t) { | ||
return t * t * ((s + 1) * t - s); | ||
return (t = +t) * t * (s * (t - 1) + t); | ||
} | ||
@@ -157,3 +162,3 @@ | ||
function backOut(t) { | ||
return --t * t * ((s + 1) * t + s) + 1; | ||
return --t * t * ((t + 1) * s + t) + 1; | ||
} | ||
@@ -186,3 +191,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); | ||
} | ||
@@ -200,3 +205,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); | ||
} | ||
@@ -215,4 +220,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; | ||
} | ||
@@ -219,0 +224,0 @@ |
@@ -1,2 +0,2 @@ | ||
// https://d3js.org/d3-ease/ v1.0.6 Copyright 2019 Mike Bostock | ||
!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((n=n||self).d3=n.d3||{})}(this,function(n){"use strict";function t(n){return((n*=2)<=1?n*n:--n*(2-n)+1)/2}function e(n){return((n*=2)<=1?n*n*n:(n-=2)*n*n+2)/2}var u=function n(t){function e(n){return Math.pow(n,t)}return t=+t,e.exponent=n,e}(3),r=function n(t){function e(n){return 1-Math.pow(1-n,t)}return t=+t,e.exponent=n,e}(3),a=function n(t){function e(n){return((n*=2)<=1?Math.pow(n,t):2-Math.pow(2-n,t))/2}return t=+t,e.exponent=n,e}(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(t){function e(n){return n*n*((t+1)*n-t)}return t=+t,e.overshoot=n,e}(1.70158),B=function n(t){function e(n){return--n*n*((t+1)*n+t)+1}return t=+t,e.overshoot=n,e}(1.70158),C=function n(t){function e(n){return((n*=2)<1?n*n*((t+1)*n-t):(n-=2)*n*((t+1)*n+t)+2)/2}return t=+t,e.overshoot=n,e}(1.70158),E=2*Math.PI,P=function n(t,e){var u=Math.asin(1/(t=Math.max(1,t)))*(e/=E);function r(n){return t*Math.pow(2,10*--n)*Math.sin((u-n)/e)}return r.amplitude=function(t){return n(t,e*E)},r.period=function(e){return n(t,e)},r}(1,.3),b=function n(t,e){var u=Math.asin(1/(t=Math.max(1,t)))*(e/=E);function r(n){return 1-t*Math.pow(2,-10*(n=+n))*Math.sin((n+u)/e)}return r.amplitude=function(t){return n(t,e*E)},r.period=function(e){return n(t,e)},r}(1,.3),k=function n(t,e){var u=Math.asin(1/(t=Math.max(1,t)))*(e/=E);function r(n){return((n=2*n-1)<0?t*Math.pow(2,10*n)*Math.sin((u-n)/e):2-t*Math.pow(2,-10*n)*Math.sin((u+n)/e))/2}return r.amplitude=function(t){return n(t,e*E)},r.period=function(e){return n(t,e)},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=e,n.easeCubicIn=function(n){return n*n*n},n.easeCubicInOut=e,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=function(n){return+n},n.easePoly=a,n.easePolyIn=u,n.easePolyInOut=a,n.easePolyOut=r,n.easeQuad=t,n.easeQuadIn=function(n){return n*n},n.easeQuadInOut=t,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/ v1.0.7 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=function(n){return+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": "1.0.6", | ||
"version": "1.0.7", | ||
"description": "Easing functions for smooth animation.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -48,3 +48,3 @@ # d3-ease | ||
[<img src="https://raw.githubusercontent.com/d3/d3-ease/master/img/linear.png" alt="linear" width="100%" height="240">](https://observablehq.com/@d3/easing#linear) | ||
[<img src="https://raw.githubusercontent.com/d3/d3-ease/master/img/linear.png" alt="linear">](https://observablehq.com/@d3/easing#linear) | ||
@@ -55,3 +55,3 @@ <a name="easePolyIn" href="#easePolyIn">#</a> d3.<b>easePolyIn</b>(<i>t</i>) [<>](https://github.com/d3/d3-ease/blob/master/src/poly.js#L3 "Source") | ||
[<img src="https://raw.githubusercontent.com/d3/d3-ease/master/img/polyIn.png" alt="polyIn" width="100%" height="240">](https://observablehq.com/@d3/easing#polyIn) | ||
[<img src="https://raw.githubusercontent.com/d3/d3-ease/master/img/polyIn.png" alt="polyIn">](https://observablehq.com/@d3/easing#polyIn) | ||
@@ -62,3 +62,3 @@ <a name="easePolyOut" href="#easePolyOut">#</a> d3.<b>easePolyOut</b>(<i>t</i>) [<>](https://github.com/d3/d3-ease/blob/master/src/poly.js#L15 "Source") | ||
[<img src="https://raw.githubusercontent.com/d3/d3-ease/master/img/polyOut.png" alt="polyOut" width="100%" height="240">](https://observablehq.com/@d3/easing#polyOut) | ||
[<img src="https://raw.githubusercontent.com/d3/d3-ease/master/img/polyOut.png" alt="polyOut">](https://observablehq.com/@d3/easing#polyOut) | ||
@@ -70,3 +70,3 @@ <a name="easePoly" href="#easePoly">#</a> d3.<b>easePoly</b>(<i>t</i>) [<>](https://github.com/d3/d3-ease/blob/master/src/poly.js "Source") | ||
[<img src="https://raw.githubusercontent.com/d3/d3-ease/master/img/polyInOut.png" alt="polyInOut" width="100%" height="240">](https://observablehq.com/@d3/easing#polyInOut) | ||
[<img src="https://raw.githubusercontent.com/d3/d3-ease/master/img/polyInOut.png" alt="polyInOut">](https://observablehq.com/@d3/easing#polyInOut) | ||
@@ -87,3 +87,3 @@ <a name="poly_exponent" href="#poly_exponent">#</a> <i>poly</i>.<b>exponent</b>(<i>e</i>) [<>](https://github.com/d3/d3-ease/blob/master/src/poly.js#L1 "Source") | ||
[<img src="https://raw.githubusercontent.com/d3/d3-ease/master/img/quadIn.png" alt="quadIn" width="100%" height="240">](https://observablehq.com/@d3/easing#quadIn) | ||
[<img src="https://raw.githubusercontent.com/d3/d3-ease/master/img/quadIn.png" alt="quadIn">](https://observablehq.com/@d3/easing#quadIn) | ||
@@ -94,3 +94,3 @@ <a name="easeQuadOut" href="#easeQuadOut">#</a> d3.<b>easeQuadOut</b>(<i>t</i>) [<>](https://github.com/d3/d3-ease/blob/master/src/quad.js#L5 "Source") | ||
[<img src="https://raw.githubusercontent.com/d3/d3-ease/master/img/quadOut.png" alt="quadOut" width="100%" height="240">](https://observablehq.com/@d3/easing#quadOut) | ||
[<img src="https://raw.githubusercontent.com/d3/d3-ease/master/img/quadOut.png" alt="quadOut">](https://observablehq.com/@d3/easing#quadOut) | ||
@@ -102,3 +102,3 @@ <a name="easeQuad" href="#easeQuad">#</a> d3.<b>easeQuad</b>(<i>t</i>) [<>](https://github.com/d3/d3-ease/blob/master/src/quad.js "Source") | ||
[<img src="https://raw.githubusercontent.com/d3/d3-ease/master/img/quadInOut.png" alt="quadInOut" width="100%" height="240">](https://observablehq.com/@d3/easing#quadInOut) | ||
[<img src="https://raw.githubusercontent.com/d3/d3-ease/master/img/quadInOut.png" alt="quadInOut">](https://observablehq.com/@d3/easing#quadInOut) | ||
@@ -109,3 +109,3 @@ <a name="easeCubicIn" href="#easeCubicIn">#</a> d3.<b>easeCubicIn</b>(<i>t</i>) [<>](https://github.com/d3/d3-ease/blob/master/src/cubic.js#L1 "Source") | ||
[<img src="https://raw.githubusercontent.com/d3/d3-ease/master/img/cubicIn.png" alt="cubicIn" width="100%" height="240">](https://observablehq.com/@d3/easing#cubicIn) | ||
[<img src="https://raw.githubusercontent.com/d3/d3-ease/master/img/cubicIn.png" alt="cubicIn">](https://observablehq.com/@d3/easing#cubicIn) | ||
@@ -116,3 +116,3 @@ <a name="easeCubicOut" href="#easeCubicOut">#</a> d3.<b>easeCubicOut</b>(<i>t</i>) [<>](https://github.com/d3/d3-ease/blob/master/src/cubic.js#L5 "Source") | ||
[<img src="https://raw.githubusercontent.com/d3/d3-ease/master/img/cubicOut.png" alt="cubicOut" width="100%" height="240">](https://observablehq.com/@d3/easing#cubicOut) | ||
[<img src="https://raw.githubusercontent.com/d3/d3-ease/master/img/cubicOut.png" alt="cubicOut">](https://observablehq.com/@d3/easing#cubicOut) | ||
@@ -124,3 +124,3 @@ <a name="easeCubic" href="#easeCubic">#</a> d3.<b>easeCubic</b>(<i>t</i>) [<>](https://github.com/d3/d3-ease/blob/master/src/cubic.js "Source") | ||
[<img src="https://raw.githubusercontent.com/d3/d3-ease/master/img/cubicInOut.png" alt="cubicInOut" width="100%" height="240">](https://observablehq.com/@d3/easing#cubicInOut) | ||
[<img src="https://raw.githubusercontent.com/d3/d3-ease/master/img/cubicInOut.png" alt="cubicInOut">](https://observablehq.com/@d3/easing#cubicInOut) | ||
@@ -131,3 +131,3 @@ <a name="easeSinIn" href="#easeSinIn">#</a> d3.<b>easeSinIn</b>(<i>t</i>) [<>](https://github.com/d3/d3-ease/blob/master/src/sin.js#L4 "Source") | ||
[<img src="https://raw.githubusercontent.com/d3/d3-ease/master/img/sinIn.png" alt="sinIn" width="100%" height="240">](https://observablehq.com/@d3/easing#sinIn) | ||
[<img src="https://raw.githubusercontent.com/d3/d3-ease/master/img/sinIn.png" alt="sinIn">](https://observablehq.com/@d3/easing#sinIn) | ||
@@ -138,3 +138,3 @@ <a name="easeSinOut" href="#easeSinOut">#</a> d3.<b>easeSinOut</b>(<i>t</i>) [<>](https://github.com/d3/d3-ease/blob/master/src/sin.js#L8 "Source") | ||
[<img src="https://raw.githubusercontent.com/d3/d3-ease/master/img/sinOut.png" alt="sinOut" width="100%" height="240">](https://observablehq.com/@d3/easing#sinOut) | ||
[<img src="https://raw.githubusercontent.com/d3/d3-ease/master/img/sinOut.png" alt="sinOut">](https://observablehq.com/@d3/easing#sinOut) | ||
@@ -146,3 +146,3 @@ <a name="easeSin" href="#easeSin">#</a> d3.<b>easeSin</b>(<i>t</i>) [<>](https://github.com/d3/d3-ease/blob/master/src/sin.js "Source") | ||
[<img src="https://raw.githubusercontent.com/d3/d3-ease/master/img/sinInOut.png" alt="sinInOut" width="100%" height="240">](https://observablehq.com/@d3/easing#sinInOut) | ||
[<img src="https://raw.githubusercontent.com/d3/d3-ease/master/img/sinInOut.png" alt="sinInOut">](https://observablehq.com/@d3/easing#sinInOut) | ||
@@ -153,3 +153,3 @@ <a name="easeExpIn" href="#easeExpIn">#</a> d3.<b>easeExpIn</b>(<i>t</i>) [<>](https://github.com/d3/d3-ease/blob/master/src/exp.js#L1 "Source") | ||
[<img src="https://raw.githubusercontent.com/d3/d3-ease/master/img/expIn.png" alt="expIn" width="100%" height="240">](https://observablehq.com/@d3/easing#expIn) | ||
[<img src="https://raw.githubusercontent.com/d3/d3-ease/master/img/expIn.png" alt="expIn">](https://observablehq.com/@d3/easing#expIn) | ||
@@ -160,3 +160,3 @@ <a name="easeExpOut" href="#easeExpOut">#</a> d3.<b>easeExpOut</b>(<i>t</i>) [<>](https://github.com/d3/d3-ease/blob/master/src/exp.js#L5 "Source") | ||
[<img src="https://raw.githubusercontent.com/d3/d3-ease/master/img/expOut.png" alt="expOut" width="100%" height="240">](https://observablehq.com/@d3/easing#expOut) | ||
[<img src="https://raw.githubusercontent.com/d3/d3-ease/master/img/expOut.png" alt="expOut">](https://observablehq.com/@d3/easing#expOut) | ||
@@ -168,3 +168,3 @@ <a name="easeExp" href="#easeExp">#</a> d3.<b>easeExp</b>(<i>t</i>) [<>](https://github.com/d3/d3-ease/blob/master/src/exp.js "Source") | ||
[<img src="https://raw.githubusercontent.com/d3/d3-ease/master/img/expInOut.png" alt="expInOut" width="100%" height="240">](https://observablehq.com/@d3/easing#expInOut) | ||
[<img src="https://raw.githubusercontent.com/d3/d3-ease/master/img/expInOut.png" alt="expInOut">](https://observablehq.com/@d3/easing#expInOut) | ||
@@ -175,3 +175,3 @@ <a name="easeCircleIn" href="#easeCircleIn">#</a> d3.<b>easeCircleIn</b>(<i>t</i>) [<>](https://github.com/d3/d3-ease/blob/master/src/circle.js#L1 "Source") | ||
[<img src="https://raw.githubusercontent.com/d3/d3-ease/master/img/circleIn.png" alt="circleIn" width="100%" height="240">](https://observablehq.com/@d3/easing#circleIn) | ||
[<img src="https://raw.githubusercontent.com/d3/d3-ease/master/img/circleIn.png" alt="circleIn">](https://observablehq.com/@d3/easing#circleIn) | ||
@@ -182,3 +182,3 @@ <a name="easeCircleOut" href="#easeCircleOut">#</a> d3.<b>easeCircleOut</b>(<i>t</i>) [<>](https://github.com/d3/d3-ease/blob/master/src/circle.js#L5 "Source") | ||
[<img src="https://raw.githubusercontent.com/d3/d3-ease/master/img/circleOut.png" alt="circleOut" width="100%" height="240">](https://observablehq.com/@d3/easing#circleOut) | ||
[<img src="https://raw.githubusercontent.com/d3/d3-ease/master/img/circleOut.png" alt="circleOut">](https://observablehq.com/@d3/easing#circleOut) | ||
@@ -190,3 +190,3 @@ <a name="easeCircle" href="#easeCircle">#</a> d3.<b>easeCircle</b>(<i>t</i>) [<>](https://github.com/d3/d3-ease/blob/master/src/circle.js "Source") | ||
[<img src="https://raw.githubusercontent.com/d3/d3-ease/master/img/circleInOut.png" alt="circleInOut" width="100%" height="240">](https://observablehq.com/@d3/easing#circleInOut) | ||
[<img src="https://raw.githubusercontent.com/d3/d3-ease/master/img/circleInOut.png" alt="circleInOut">](https://observablehq.com/@d3/easing#circleInOut) | ||
@@ -197,3 +197,3 @@ <a name="easeElasticIn" href="#easeElasticIn">#</a> d3.<b>easeElasticIn</b>(<i>t</i>) [<>](https://github.com/d3/d3-ease/blob/master/src/elastic.js#L5 "Source") | ||
[<img src="https://raw.githubusercontent.com/d3/d3-ease/master/img/elasticIn.png" alt="elasticIn" width="100%" height="360">](https://observablehq.com/@d3/easing#elasticIn) | ||
[<img src="https://raw.githubusercontent.com/d3/d3-ease/master/img/elasticIn.png" alt="elasticIn">](https://observablehq.com/@d3/easing#elasticIn) | ||
@@ -205,3 +205,3 @@ <a name="easeElastic" href="#easeElastic">#</a> d3.<b>easeElastic</b>(<i>t</i>) [<>](https://github.com/d3/d3-ease/blob/master/src/elastic.js "Source") | ||
[<img src="https://raw.githubusercontent.com/d3/d3-ease/master/img/elasticOut.png" alt="elasticOut" width="100%" height="360">](https://observablehq.com/@d3/easing#elasticOut) | ||
[<img src="https://raw.githubusercontent.com/d3/d3-ease/master/img/elasticOut.png" alt="elasticOut">](https://observablehq.com/@d3/easing#elasticOut) | ||
@@ -212,3 +212,3 @@ <a name="easeElasticInOut" href="#easeElasticInOut">#</a> d3.<b>easeElasticInOut</b>(<i>t</i>) [<>](https://github.com/d3/d3-ease/blob/master/src/elastic.js#L31 "Source") | ||
[<img src="https://raw.githubusercontent.com/d3/d3-ease/master/img/elasticInOut.png" alt="elasticInOut" width="100%" height="360">](https://observablehq.com/@d3/easing#elasticInOut) | ||
[<img src="https://raw.githubusercontent.com/d3/d3-ease/master/img/elasticInOut.png" alt="elasticInOut">](https://observablehq.com/@d3/easing#elasticInOut) | ||
@@ -227,3 +227,3 @@ <a name="elastic_amplitude" href="#elastic_amplitude">#</a> <i>elastic</i>.<b>amplitude</b>(<i>a</i>) [<>](https://github.com/d3/d3-ease/blob/master/src/elastic.js#L40 "Source") | ||
[<img src="https://raw.githubusercontent.com/d3/d3-ease/master/img/backIn.png" alt="backIn" width="100%" height="300">](https://observablehq.com/@d3/easing#backIn) | ||
[<img src="https://raw.githubusercontent.com/d3/d3-ease/master/img/backIn.png" alt="backIn">](https://observablehq.com/@d3/easing#backIn) | ||
@@ -234,3 +234,3 @@ <a name="easeBackOut" href="#easeBackOut">#</a> d3.<b>easeBackOut</b>(<i>t</i>) [<>](https://github.com/d3/d3-ease/blob/master/src/back.js#L15 "Source") | ||
[<img src="https://raw.githubusercontent.com/d3/d3-ease/master/img/backOut.png" alt="backOut" width="100%" height="300">](https://observablehq.com/@d3/easing#backOut) | ||
[<img src="https://raw.githubusercontent.com/d3/d3-ease/master/img/backOut.png" alt="backOut">](https://observablehq.com/@d3/easing#backOut) | ||
@@ -242,3 +242,3 @@ <a name="easeBack" href="#easeBack">#</a> d3.<b>easeBack</b>(<i>t</i>) [<>](https://github.com/d3/d3-ease/blob/master/src/back.js "Source") | ||
[<img src="https://raw.githubusercontent.com/d3/d3-ease/master/img/backInOut.png" alt="backInOut" width="100%" height="300">](https://observablehq.com/@d3/easing#backInOut) | ||
[<img src="https://raw.githubusercontent.com/d3/d3-ease/master/img/backInOut.png" alt="backInOut">](https://observablehq.com/@d3/easing#backInOut) | ||
@@ -253,3 +253,3 @@ <a name="back_overshoot" href="#back_overshoot">#</a> <i>back</i>.<b>overshoot</b>(<i>s</i>) [<>](https://github.com/d3/d3-ease/blob/master/src/back.js#L1 "Source") | ||
[<img src="https://raw.githubusercontent.com/d3/d3-ease/master/img/bounceIn.png" alt="bounceIn" width="100%" height="240">](https://observablehq.com/@d3/easing#bounceIn) | ||
[<img src="https://raw.githubusercontent.com/d3/d3-ease/master/img/bounceIn.png" alt="bounceIn">](https://observablehq.com/@d3/easing#bounceIn) | ||
@@ -261,3 +261,3 @@ <a name="easeBounce" href="#easeBounce">#</a> d3.<b>easeBounce</b>(<i>t</i>) [<>](https://github.com/d3/d3-ease/blob/master/src/bounce.js "Source") | ||
[<img src="https://raw.githubusercontent.com/d3/d3-ease/master/img/bounceOut.png" alt="bounceOut" width="100%" height="240">](https://observablehq.com/@d3/easing#bounceOut) | ||
[<img src="https://raw.githubusercontent.com/d3/d3-ease/master/img/bounceOut.png" alt="bounceOut">](https://observablehq.com/@d3/easing#bounceOut) | ||
@@ -268,2 +268,2 @@ <a name="easeBounceInOut" href="#easeBounceInOut">#</a> d3.<b>easeBounceInOut</b>(<i>t</i>) [<>](https://github.com/d3/d3-ease/blob/master/src/bounce.js#L20 "Source") | ||
[<img src="https://raw.githubusercontent.com/d3/d3-ease/master/img/bounceInOut.png" alt="bounceInOut" width="100%" height="240">](https://observablehq.com/@d3/easing#bounceInOut) | ||
[<img src="https://raw.githubusercontent.com/d3/d3-ease/master/img/bounceInOut.png" alt="bounceInOut">](https://observablehq.com/@d3/easing#bounceInOut) |
@@ -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
17
427
34393