function stagger(params) {
  var value = params.value;
  var p = params;
  var val = typeof value === 'number' ? value.toString() : value;
  var easing;
  var grid = p.grid;
  var axis = p.axis;
  var fromIndex = p.from || 0;

  if (fromIndex === 'edges') {
    fromIndex = 'center';

    if (!p.dir || p.dir === 'normal') {
      p.dir = 'reverse';
    } else {
      p.dir = 'normal';
    }
  }

  var dir = p.dir || 'normal';
  var fromCenter = fromIndex === 'center';
  var isRange = Array.isArray(val);
  var val1;
  var val2;
  var unit;

  if (params && params.easing && typeof params.easing === 'string') {
    easing = (0,_sauce_custom_easings__WEBPACK_IMPORTED_MODULE_0__.getCustomEasing)(params.easing) || (0,_easings__WEBPACK_IMPORTED_MODULE_2__.parserEasings)(params.easing);
  } else {
    easing = null;
  }

  if (Array.isArray(val)) {
    val1 = parseFloat(val[0]);
    val2 = parseFloat(val[1]);
    unit = (0,_utilities_get_unit__WEBPACK_IMPORTED_MODULE_1__.default)(val[1]) || '';
  } else {
    val1 = parseFloat(val);
    val2 = 0;
    unit = (0,_utilities_get_unit__WEBPACK_IMPORTED_MODULE_1__.default)(val) || '';
  }

  var start = parseFloat(p.start) || 0 + (isRange ? val1 : 0);
  var values = [];
  var maxValue = 0;
  return function (el, i, t) {
    var fIndex;

    switch (fromIndex) {
      case 'first':
        fIndex = 0;
        break;

      case 'center':
        fIndex = (t - 1) / 2;
        break;

      case 'last':
        fIndex = t - 1;
        break;

      case 'random':
        fIndex = Math.floor(Math.random() * (t + 1));
        break;

      default:
        fIndex = fromIndex;
        break;
    }

    if (!values.length) {
      for (var index = 0; index < t; index += 1) {
        if (!grid) {
          values.push(Math.abs(fIndex - index));
        } else {
          var fromX = !fromCenter ? fIndex % grid[0] : (grid[0] - 1) / 2;
          var fromY = !fromCenter ? Math.floor(fIndex / grid[0]) : (grid[1] - 1) / 2;
          var toX = index % grid[0];
          var toY = Math.floor(index / grid[0]);
          var distanceX = fromX - toX;
          var distanceY = fromY - toY;

          var _r = Math.sqrt(distanceX * distanceX + distanceY * distanceY);

          if (axis === 'x') {
            _r = -distanceX;
          }

          if (axis === 'y') {
            _r = -distanceY;
          }

          values.push(_r);
        }

        maxValue = Math.max.apply(Math, _toConsumableArray(values));
      }

      if (easing) {
        values = values.map(function (v) {
          return easing(v / maxValue, el, i, t) * maxValue;
        });
      }

      if (dir === 'reverse') {
        values = values.map(function (v) {
          if (axis) {
            return v < 0 ? v * -1 : -v;
          }

          return Math.abs(maxValue - v);
        });
      }
    }

    var spacing = isRange ? (val2 - val1) / maxValue : val1;
    var r = start + spacing * (Math.round(values[i] * 100) / 100);
    return unit ? r + unit : r;
  };
}
/* The code below is based on the implementation of anime.js v3.2.1 Copyright (c) 2020 Julian Garnier  */
The code below is based on the implementation of anime.js v3.2.1 Copyright (c) 2020 Julian Garnier
The code below is based on the implementation of anime . js v3 . 2 . 1 Copyright ( c ) 2020 Julian Garnier
function stagger(params) {
  var value = params.value;
  var p = params;
  var val = typeof value === 'number' ? value.toString() : value;
  var easing;
  var grid = p.grid;
  var axis = p.axis;
  var fromIndex = p.from || 0;
  if (fromIndex === 'edges') {
    fromIndex = 'center';
    if (!p.dir || p.dir === 'normal') {
      p.dir = 'reverse';
    } else {
      p.dir = 'normal';
    }
  }
  var dir = p.dir || 'normal';
  var fromCenter = fromIndex === 'center';
  var isRange = Array.isArray(val);
  var val1;
  var val2;
  var unit;
  if (params && params.easing && typeof params.easing === 'string') {
    easing = (0,_sauce_custom_easings__WEBPACK_IMPORTED_MODULE_0__.getCustomEasing)(params.easing) || (0,_easings__WEBPACK_IMPORTED_MODULE_2__.parserEasings)(params.easing);
  } else {
    easing = null;
  }
  if (Array.isArray(val)) {
    val1 = parseFloat(val[0]);
    val2 = parseFloat(val[1]);
    unit = (0,_utilities_get_unit__WEBPACK_IMPORTED_MODULE_1__.default)(val[1]) || '';
  } else {
    val1 = parseFloat(val);
    val2 = 0;
    unit = (0,_utilities_get_unit__WEBPACK_IMPORTED_MODULE_1__.default)(val) || '';
  }
  var start = parseFloat(p.start) || 0 + (isRange ? val1 : 0);
  var values = [];
  var maxValue = 0;
  return function (el, i, t) {
    var fIndex;
    switch (fromIndex) {
      case 'first':
        fIndex = 0;
        break;
      case 'center':
        fIndex = (t - 1) / 2;
        break;
      case 'last':
        fIndex = t - 1;
        break;
      case 'random':
        fIndex = Math.floor(Math.random() * (t + 1));
        break;
      default:
        fIndex = fromIndex;
        break;
    }
    if (!values.length) {
      for (var index = 0; index < t; index += 1) {
        if (!grid) {
          values.push(Math.abs(fIndex - index));
        } else {
          var fromX = !fromCenter ? fIndex % grid[0] : (grid[0] - 1) / 2;
          var fromY = !fromCenter ? Math.floor(fIndex / grid[0]) : (grid[1] - 1) / 2;
          var toX = index % grid[0];
          var toY = Math.floor(index / grid[0]);
          var distanceX = fromX - toX;
          var distanceY = fromY - toY;
          var _r = Math.sqrt(distanceX * distanceX + distanceY * distanceY);
          if (axis === 'x') {
            _r = -distanceX;
          }
          if (axis === 'y') {
            _r = -distanceY;
          }
          values.push(_r);
        }
        maxValue = Math.max.apply(Math, _toConsumableArray(values));
      }
      if (easing) {
        values = values.map(function (v) {
          return easing(v / maxValue, el, i, t) * maxValue;
        });
      }
      if (dir === 'reverse') {
        values = values.map(function (v) {
          if (axis) {
            return v < 0 ? v * -1 : -v;
          }
          return Math.abs(maxValue - v);
        });
      }
    }
    var spacing = isRange ? (val2 - val1) / maxValue : val1;
    var r = start + spacing * (Math.round(values[i] * 100) / 100);
    return unit ? r + unit : r;
  };
}
function stagger ( params ) { var value = params . value ; var p = params ; var val = typeof value === 'number' ? value . toString ( ) : value ; var easing ; var grid = p . grid ; var axis = p . axis ; var fromIndex = p . from || 0 ; if ( fromIndex === 'edges' ) { fromIndex = 'center' ; if ( ! p . dir || p . dir === 'normal' ) { p . dir = 'reverse' ; } else { p . dir = 'normal' ; } } var dir = p . dir || 'normal' ; var fromCenter = fromIndex === 'center' ; var isRange = Array . isArray ( val ) ; var val1 ; var val2 ; var unit ; if ( params && params . easing && typeof params . easing === 'string' ) { easing = ( 0 , _sauce_custom_easings__WEBPACK_IMPORTED_MODULE_0__ . getCustomEasing ) ( params . easing ) || ( 0 , _easings__WEBPACK_IMPORTED_MODULE_2__ . parserEasings ) ( params . easing ) ; } else { easing = null ; } if ( Array . isArray ( val ) ) { val1 = parseFloat ( val [ 0 ] ) ; val2 = parseFloat ( val [ 1 ] ) ; unit = ( 0 , _utilities_get_unit__WEBPACK_IMPORTED_MODULE_1__ . default ) ( val [ 1 ] ) || '' ; } else { val1 = parseFloat ( val ) ; val2 = 0 ; unit = ( 0 , _utilities_get_unit__WEBPACK_IMPORTED_MODULE_1__ . default ) ( val ) || '' ; } var start = parseFloat ( p . start ) || 0 + ( isRange ? val1 : 0 ) ; var values = [ ] ; var maxValue = 0 ; return function ( el , i , t ) { var fIndex ; switch ( fromIndex ) { case 'first' : fIndex = 0 ; break ; case 'center' : fIndex = ( t - 1 ) / 2 ; break ; case 'last' : fIndex = t - 1 ; break ; case 'random' : fIndex = Math . floor ( Math . random ( ) * ( t + 1 ) ) ; break ; default : fIndex = fromIndex ; break ; } if ( ! values . length ) { for ( var index = 0 ; index < t ; index += 1 ) { if ( ! grid ) { values . push ( Math . abs ( fIndex - index ) ) ; } else { var fromX = ! fromCenter ? fIndex % grid [ 0 ] : ( grid [ 0 ] - 1 ) / 2 ; var fromY = ! fromCenter ? Math . floor ( fIndex / grid [ 0 ] ) : ( grid [ 1 ] - 1 ) / 2 ; var toX = index % grid [ 0 ] ; var toY = Math . floor ( index / grid [ 0 ] ) ; var distanceX = fromX - toX ; var distanceY = fromY - toY ; var _r = Math . sqrt ( distanceX * distanceX + distanceY * distanceY ) ; if ( axis === 'x' ) { _r = - distanceX ; } if ( axis === 'y' ) { _r = - distanceY ; } values . push ( _r ) ; } maxValue = Math . max . apply ( Math , _toConsumableArray ( values ) ) ; } if ( easing ) { values = values . map ( function ( v ) { return easing ( v / maxValue , el , i , t ) * maxValue ; } ) ; } if ( dir === 'reverse' ) { values = values . map ( function ( v ) { if ( axis ) { return v < 0 ? v * - 1 : - v ; } return Math . abs ( maxValue - v ) ; } ) ; } } var spacing = isRange ? ( val2 - val1 ) / maxValue : val1 ; var r = start + spacing * ( Math . round ( values [ i ] * 100 ) / 100 ) ; return unit ? r + unit : r ; } ; }
The code below is based on the implementation of anime.js v3.2.1 Copyright (c) 2020 Julian Garnier
The code below is based on the implementation of anime . js v3 . 2 . 1 Copyright ( c ) 2020 Julian Garnier