123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262 |
- // https://d3js.org/d3-ease/ v3.0.1 Copyright 2010-2021 Mike Bostock, 2001 Robert Penner
- (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;
- }
-
- // 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 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 });
-
- })));
|