| |
| (function (global, factory) { |
| typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : |
| typeof define === 'function' && define.amd ? define(['exports'], factory) : |
| (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.d3 = global.d3 || {})); |
| }(this, (function (exports) { 'use strict'; |
|
|
| const linear = t => +t; |
|
|
| function quadIn(t) { |
| return t * t; |
| } |
|
|
| function quadOut(t) { |
| return t * (2 - t); |
| } |
|
|
| function quadInOut(t) { |
| return ((t *= 2) <= 1 ? t * t : --t * (2 - t) + 1) / 2; |
| } |
|
|
| function cubicIn(t) { |
| return t * t * t; |
| } |
|
|
| function cubicOut(t) { |
| return --t * t * t + 1; |
| } |
|
|
| function cubicInOut(t) { |
| return ((t *= 2) <= 1 ? t * t * t : (t -= 2) * t * t + 2) / 2; |
| } |
|
|
| var exponent = 3; |
|
|
| var polyIn = (function custom(e) { |
| e = +e; |
|
|
| function polyIn(t) { |
| return Math.pow(t, e); |
| } |
|
|
| polyIn.exponent = custom; |
|
|
| return polyIn; |
| })(exponent); |
|
|
| var polyOut = (function custom(e) { |
| e = +e; |
|
|
| function polyOut(t) { |
| return 1 - Math.pow(1 - t, e); |
| } |
|
|
| polyOut.exponent = custom; |
|
|
| return polyOut; |
| })(exponent); |
|
|
| var polyInOut = (function custom(e) { |
| e = +e; |
|
|
| function polyInOut(t) { |
| return ((t *= 2) <= 1 ? Math.pow(t, e) : 2 - Math.pow(2 - t, e)) / 2; |
| } |
|
|
| polyInOut.exponent = custom; |
|
|
| return polyInOut; |
| })(exponent); |
|
|
| var pi = Math.PI, |
| halfPi = pi / 2; |
|
|
| function sinIn(t) { |
| return (+t === 1) ? 1 : 1 - Math.cos(t * halfPi); |
| } |
|
|
| function sinOut(t) { |
| return Math.sin(t * halfPi); |
| } |
|
|
| function sinInOut(t) { |
| return (1 - Math.cos(pi * t)) / 2; |
| } |
|
|
| |
| function tpmt(x) { |
| return (Math.pow(2, -10 * x) - 0.0009765625) * 1.0009775171065494; |
| } |
|
|
| function expIn(t) { |
| return tpmt(1 - +t); |
| } |
|
|
| function expOut(t) { |
| return 1 - tpmt(t); |
| } |
|
|
| function expInOut(t) { |
| return ((t *= 2) <= 1 ? tpmt(1 - t) : 2 - tpmt(t - 1)) / 2; |
| } |
|
|
| function circleIn(t) { |
| return 1 - Math.sqrt(1 - t * t); |
| } |
|
|
| function circleOut(t) { |
| return Math.sqrt(1 - --t * t); |
| } |
|
|
| function circleInOut(t) { |
| return ((t *= 2) <= 1 ? 1 - Math.sqrt(1 - t * t) : Math.sqrt(1 - (t -= 2) * t) + 1) / 2; |
| } |
|
|
| var b1 = 4 / 11, |
| b2 = 6 / 11, |
| b3 = 8 / 11, |
| b4 = 3 / 4, |
| b5 = 9 / 11, |
| b6 = 10 / 11, |
| b7 = 15 / 16, |
| b8 = 21 / 22, |
| b9 = 63 / 64, |
| b0 = 1 / b1 / b1; |
|
|
| function bounceIn(t) { |
| return 1 - bounceOut(1 - t); |
| } |
|
|
| function bounceOut(t) { |
| return (t = +t) < b1 ? b0 * t * t : t < b3 ? b0 * (t -= b2) * t + b4 : t < b6 ? b0 * (t -= b5) * t + b7 : b0 * (t -= b8) * t + b9; |
| } |
|
|
| function bounceInOut(t) { |
| return ((t *= 2) <= 1 ? 1 - bounceOut(1 - t) : bounceOut(t - 1) + 1) / 2; |
| } |
|
|
| var overshoot = 1.70158; |
|
|
| var backIn = (function custom(s) { |
| s = +s; |
|
|
| function backIn(t) { |
| return (t = +t) * t * (s * (t - 1) + t); |
| } |
|
|
| backIn.overshoot = custom; |
|
|
| return backIn; |
| })(overshoot); |
|
|
| var backOut = (function custom(s) { |
| s = +s; |
|
|
| function backOut(t) { |
| return --t * t * ((t + 1) * s + t) + 1; |
| } |
|
|
| backOut.overshoot = custom; |
|
|
| return backOut; |
| })(overshoot); |
|
|
| var backInOut = (function custom(s) { |
| s = +s; |
|
|
| function backInOut(t) { |
| return ((t *= 2) < 1 ? t * t * ((s + 1) * t - s) : (t -= 2) * t * ((s + 1) * t + s) + 2) / 2; |
| } |
|
|
| backInOut.overshoot = custom; |
|
|
| return backInOut; |
| })(overshoot); |
|
|
| var tau = 2 * Math.PI, |
| amplitude = 1, |
| period = 0.3; |
|
|
| var elasticIn = (function custom(a, p) { |
| var s = Math.asin(1 / (a = Math.max(1, a))) * (p /= tau); |
|
|
| function elasticIn(t) { |
| return a * tpmt(-(--t)) * Math.sin((s - t) / p); |
| } |
|
|
| elasticIn.amplitude = function(a) { return custom(a, p * tau); }; |
| elasticIn.period = function(p) { return custom(a, p); }; |
|
|
| return elasticIn; |
| })(amplitude, period); |
|
|
| var elasticOut = (function custom(a, p) { |
| var s = Math.asin(1 / (a = Math.max(1, a))) * (p /= tau); |
|
|
| function elasticOut(t) { |
| return 1 - a * tpmt(t = +t) * Math.sin((t + s) / p); |
| } |
|
|
| elasticOut.amplitude = function(a) { return custom(a, p * tau); }; |
| elasticOut.period = function(p) { return custom(a, p); }; |
|
|
| return elasticOut; |
| })(amplitude, period); |
|
|
| var elasticInOut = (function custom(a, p) { |
| var s = Math.asin(1 / (a = Math.max(1, a))) * (p /= tau); |
|
|
| function elasticInOut(t) { |
| return ((t = t * 2 - 1) < 0 |
| ? a * tpmt(-t) * Math.sin((s - t) / p) |
| : 2 - a * tpmt(t) * Math.sin((s + t) / p)) / 2; |
| } |
|
|
| elasticInOut.amplitude = function(a) { return custom(a, p * tau); }; |
| elasticInOut.period = function(p) { return custom(a, p); }; |
|
|
| return elasticInOut; |
| })(amplitude, period); |
|
|
| exports.easeBack = backInOut; |
| exports.easeBackIn = backIn; |
| exports.easeBackInOut = backInOut; |
| exports.easeBackOut = backOut; |
| exports.easeBounce = bounceOut; |
| exports.easeBounceIn = bounceIn; |
| exports.easeBounceInOut = bounceInOut; |
| exports.easeBounceOut = bounceOut; |
| exports.easeCircle = circleInOut; |
| exports.easeCircleIn = circleIn; |
| exports.easeCircleInOut = circleInOut; |
| exports.easeCircleOut = circleOut; |
| exports.easeCubic = cubicInOut; |
| exports.easeCubicIn = cubicIn; |
| exports.easeCubicInOut = cubicInOut; |
| exports.easeCubicOut = cubicOut; |
| exports.easeElastic = elasticOut; |
| exports.easeElasticIn = elasticIn; |
| exports.easeElasticInOut = elasticInOut; |
| exports.easeElasticOut = elasticOut; |
| exports.easeExp = expInOut; |
| exports.easeExpIn = expIn; |
| exports.easeExpInOut = expInOut; |
| exports.easeExpOut = expOut; |
| exports.easeLinear = linear; |
| exports.easePoly = polyInOut; |
| exports.easePolyIn = polyIn; |
| exports.easePolyInOut = polyInOut; |
| exports.easePolyOut = polyOut; |
| exports.easeQuad = quadInOut; |
| exports.easeQuadIn = quadIn; |
| exports.easeQuadInOut = quadInOut; |
| exports.easeQuadOut = quadOut; |
| exports.easeSin = sinInOut; |
| exports.easeSinIn = sinIn; |
| exports.easeSinInOut = sinInOut; |
| exports.easeSinOut = sinOut; |
|
|
| Object.defineProperty(exports, '__esModule', { value: true }); |
|
|
| }))); |
|
|