<commit_before>/*!
 * All equations are adapted from <NAME>'
 * [Scripty2](https://github.com/madrobby/scripty2/blob/master/src/effects/transitions/penner.js).
 *
 * Based on Easing Equations (c) 2003 [<NAME>](http://www.robertpenner.com/), all rights reserved. This work is
 * [subject to terms](http://www.robertpenner.com/easing_terms_of_use.html).
 */

/*!
 *  TERMS OF USE - EASING EQUATIONS
 *  Open source under the BSD License.
 *  Easing Equations (c) 2003 <NAME>, all rights reserved.
 */
export function linear (pos) {
  return pos;
}

export function easeInQuad (pos) {
  return Math.pow(pos, 2);
}

export function easeOutQuad (pos) {
  return -(Math.pow((pos - 1), 2) - 1);
}

export function easeInOutQuad (pos) {
  if ((pos /= 0.5) < 1) {return 0.5 * Math.pow(pos,2);}
  return -0.5 * ((pos -= 2) * pos - 2);
}

export function easeInCubic (pos) {
  return Math.pow(pos, 3);
}

export function easeOutCubic (pos) {
  return (Math.pow((pos - 1), 3) + 1);
}

export function easeInOutCubic (pos) {
  if ((pos /= 0.5) < 1) {return 0.5 * Math.pow(pos,3);}
  return 0.5 * (Math.pow((pos - 2),3) + 2);
}

export function easeInQuart (pos) {
  return Math.pow(pos, 4);
}

export function easeOutQuart (pos) {
  return -(Math.pow((pos - 1), 4) - 1);
}

export function easeInOutQuart (pos) {
  if ((pos /= 0.5) < 1) {return 0.5 * Math.pow(pos,4);}
  return -0.5 * ((pos -= 2) * Math.pow(pos,3) - 2);
}

export function easeInQuint (pos) {
  return Math.pow(pos, 5);
}

export function easeOutQuint (pos) {
  return (Math.pow((pos - 1), 5) + 1);
}

export function easeInOutQuint (pos) {
  if ((pos /= 0.5) < 1) {return 0.5 * Math.pow(pos,5);}
  return 0.5 * (Math.pow((pos - 2),5) + 2);
}

export function easeInSine (pos) {
  return -Math.cos(pos * (Math.PI / 2)) + 1;
}

export function easeOutSine (pos) {
  return Math.sin(pos * (Math.PI / 2));
}

export function easeInOutSine (pos) {
  return (-0.5 * (Math.cos(Math.PI * pos) - 1));
}

export function easeInExpo (pos) {
  return (pos === 0) ? 0 : Math.pow(2, 10 * (pos - 1));
}

export function easeOutExpo (pos) {
  return (pos === 1) ? 1 : -Math.pow(2, -10 * pos) + 1;
}

export function easeInOutExpo (pos) {
  if (pos === 0) {return 0;}
  if (pos === 1) {return 1;}
  if ((pos /= 0.5) < 1) {return 0.5 * Math.pow(2,10 * (pos - 1));}
  return 0.5 * (-Math.pow(2, -10 * --pos) + 2);
}

export function easeInCirc (pos) {
  return -(Math.sqrt(1 - (pos * pos)) - 1);
}

export function easeOutCirc (pos) {
  return Math.sqrt(1 - Math.pow((pos - 1), 2));
}

export function easeInOutCirc (pos) {
  if ((pos /= 0.5) < 1) {return -0.5 * (Math.sqrt(1 - pos * pos) - 1);}
  return 0.5 * (Math.sqrt(1 - (pos -= 2) * pos) + 1);
}

export function easeOutBounce (pos) {
  if ((pos) < (1 / 2.75)) {
    return (7.5625 * pos * pos);
  } else if (pos < (2 / 2.75)) {
    return (7.5625 * (pos -= (1.5 / 2.75)) * pos + 0.75);
  } else if (pos < (2.5 / 2.75)) {
    return (7.5625 * (pos -= (2.25 / 2.75)) * pos + 0.9375);
  } else {
    return (7.5625 * (pos -= (2.625 / 2.75)) * pos + 0.984375);
  }
}

export function easeInBack (pos) {
  var s = 1.70158;
  return (pos) * pos * ((s + 1) * pos - s);
}

export function easeOutBack (pos) {
  var s = 1.70158;
  return (pos = pos - 1) * pos * ((s + 1) * pos + s) + 1;
}

export function easeInOutBack (pos) {
  var s = 1.70158;
  if ((pos /= 0.5) < 1) {
    return 0.5 * (pos * pos * (((s *= (1.525)) + 1) * pos - s));
  }
  return 0.5 * ((pos -= 2) * pos * (((s *= (1.525)) + 1) * pos + s) + 2);
}

export function elastic (pos) {
  return -1 * Math.pow(4,-8 * pos) * Math.sin((pos * 6 - 1) * (2 * Math.PI) / 2) + 1;
}

export function swingFromTo (pos) {
  var s = 1.70158;
  return ((pos /= 0.5) < 1) ?
      0.5 * (pos * pos * (((s *= (1.525)) + 1) * pos - s)) :
      0.5 * ((pos -= 2) * pos * (((s *= (1.525)) + 1) * pos + s) + 2);
}

export function swingFrom (pos) {
  var s = 1.70158;
  return pos * pos * ((s + 1) * pos - s);
}

export function swingTo (pos) {
  var s = 1.70158;
  return (pos -= 1) * pos * ((s + 1) * pos + s) + 1;
}

export function bounce (pos) {
  if (pos < (1 / 2.75)) {
    return (7.5625 * pos * pos);
  } else if (pos < (2 / 2.75)) {
    return (7.5625 * (pos -= (1.5 / 2.75)) * pos + 0.75);
  } else if (pos < (2.5 / 2.75)) {
    return (7.5625 * (pos -= (2.25 / 2.75)) * pos + 0.9375);
  } else {
    return (7.5625 * (pos -= (2.625 / 2.75)) * pos + 0.984375);
  }
}

export function bouncePast (pos) {
  if (pos < (1 / 2.75)) {
    return (7.5625 * pos * pos);
  } else if (pos < (2 / 2.75)) {
    return 2 - (7.5625 * (pos -= (1.5 / 2.75)) * pos + 0.75);
  } else if (pos < (2.5 / 2.75)) {
    return 2 - (7.5625 * (pos -= (2.25 / 2.75)) * pos + 0.9375);
  } else {
    return 2 - (7.5625 * (pos -= (2.625 / 2.75)) * pos + 0.984375);
  }
}

export function easeFromTo (pos) {
  if ((pos /= 0.5) < 1) {return 0.5 * Math.pow(pos,4);}
  return -0.5 * ((pos -= 2) * Math.pow(pos,3) - 2);
}

export function easeFrom (pos) {
  return Math.pow(pos,4);
}

export function easeTo (pos) {
  return Math.pow(pos,0.25);
}
<commit_msg>Clean up shifty.easing-functions.js<commit_after>/*!
 * All equations are adapted from <NAME>'
 * [Scripty2](https://github.com/madrobby/scripty2/blob/master/src/effects/transitions/penner.js).
 *
 * Based on Easing Equations (c) 2003 [<NAME>](http://www.robertpenner.com/), all rights reserved. This work is
 * [subject to terms](http://www.robertpenner.com/easing_terms_of_use.html).
 */

/*!
 *  TERMS OF USE - EASING EQUATIONS
 *  Open source under the BSD License.
 *  Easing Equations (c) 2003 <NAME>, all rights reserved.
 */
export const linear = pos => pos;

export const easeInQuad = pos => Math.pow(pos, 2);

export const easeOutQuad = pos => -(Math.pow((pos - 1), 2) - 1);

export const easeInOutQuad = pos =>
  (pos /= 0.5) < 1 ?
    0.5 * Math.pow(pos,2) :
    -0.5 * ((pos -= 2) * pos - 2);

export const easeInCubic = pos => Math.pow(pos, 3);

export const easeOutCubic = pos => Math.pow((pos - 1), 3) + 1;

export const easeInOutCubic = pos =>
  (pos /= 0.5) < 1 ?
    0.5 * Math.pow(pos,3) :
    0.5 * (Math.pow((pos - 2),3) + 2);

export const easeInQuart = pos => Math.pow(pos, 4);

export const easeOutQuart = pos => -(Math.pow((pos - 1), 4) - 1);

export const easeInOutQuart = pos =>
  (pos /= 0.5) < 1 ?
    0.5 * Math.pow(pos,4) :
    -0.5 * ((pos -= 2) * Math.pow(pos,3) - 2);

export const easeInQuint = pos => Math.pow(pos, 5);

export const easeOutQuint = pos => Math.pow((pos - 1), 5) + 1;

export const easeInOutQuint = pos =>
  (pos /= 0.5) < 1 ?
    0.5 * Math.pow(pos,5) :
    0.5 * (Math.pow((pos - 2),5) + 2);

export const easeInSine = pos => -Math.cos(pos * (Math.PI / 2)) + 1;

export const easeOutSine = pos => Math.sin(pos * (Math.PI / 2));

export const easeInOutSine = pos => -0.5 * (Math.cos(Math.PI * pos) - 1);

export const easeInExpo = pos => (pos === 0) ? 0 : Math.pow(2, 10 * (pos - 1));

export const easeOutExpo = pos => (pos === 1) ? 1 : -Math.pow(2, -10 * pos) + 1;

export const easeInOutExpo = pos => {
  if (pos === 0) {
    return 0;
  }

  if (pos === 1) {
    return 1;
  }

  if ((pos /= 0.5) < 1) {
    return 0.5 * Math.pow(2,10 * (pos - 1));
  }

  return 0.5 * (-Math.pow(2, -10 * --pos) + 2);
};

export const easeInCirc = pos => -(Math.sqrt(1 - (pos * pos)) - 1);

export const easeOutCirc = pos => Math.sqrt(1 - Math.pow((pos - 1), 2));

export const easeInOutCirc = pos =>
  ((pos /= 0.5) < 1) ?
    -0.5 * (Math.sqrt(1 - pos * pos) - 1) :
    0.5 * (Math.sqrt(1 - (pos -= 2) * pos) + 1);

export const easeOutBounce = pos => {
  if (pos < (1 / 2.75)) {
    return (7.5625 * pos * pos);
  } else if (pos < (2 / 2.75)) {
    return (7.5625 * (pos -= (1.5 / 2.75)) * pos + 0.75);
  } else if (pos < (2.5 / 2.75)) {
    return (7.5625 * (pos -= (2.25 / 2.75)) * pos + 0.9375);
  } else {
    return (7.5625 * (pos -= (2.625 / 2.75)) * pos + 0.984375);
  }
};

export const easeInBack = pos => {
  const s = 1.70158;
  return pos * pos * ((s + 1) * pos - s);
};

export const easeOutBack = pos => {
  const s = 1.70158;
  return (pos = pos - 1) * pos * ((s + 1) * pos + s) + 1;
};

export const easeInOutBack = pos => {
  let s = 1.70158;
  if ((pos /= 0.5) < 1) {
    return 0.5 * (pos * pos * (((s *= (1.525)) + 1) * pos - s));
  }
  return 0.5 * ((pos -= 2) * pos * (((s *= (1.525)) + 1) * pos + s) + 2);
};

export const elastic = pos =>
  -1 * Math.pow(4,-8 * pos) * Math.sin((pos * 6 - 1) * (2 * Math.PI) / 2) + 1;

export const swingFromTo = pos => {
  let s = 1.70158;
  return ((pos /= 0.5) < 1) ?
      0.5 * (pos * pos * (((s *= (1.525)) + 1) * pos - s)) :
      0.5 * ((pos -= 2) * pos * (((s *= (1.525)) + 1) * pos + s) + 2);
};

export const swingFrom = pos => {
  const s = 1.70158;
  return pos * pos * ((s + 1) * pos - s);
};

export const swingTo = pos => {
  const s = 1.70158;
  return (pos -= 1) * pos * ((s + 1) * pos + s) + 1;
};

export const bounce = pos => {
  if (pos < (1 / 2.75)) {
    return (7.5625 * pos * pos);
  } else if (pos < (2 / 2.75)) {
    return (7.5625 * (pos -= (1.5 / 2.75)) * pos + 0.75);
  } else if (pos < (2.5 / 2.75)) {
    return (7.5625 * (pos -= (2.25 / 2.75)) * pos + 0.9375);
  } else {
    return (7.5625 * (pos -= (2.625 / 2.75)) * pos + 0.984375);
  }
};

export const bouncePast = pos => {
  if (pos < (1 / 2.75)) {
    return (7.5625 * pos * pos);
  } else if (pos < (2 / 2.75)) {
    return 2 - (7.5625 * (pos -= (1.5 / 2.75)) * pos + 0.75);
  } else if (pos < (2.5 / 2.75)) {
    return 2 - (7.5625 * (pos -= (2.25 / 2.75)) * pos + 0.9375);
  } else {
    return 2 - (7.5625 * (pos -= (2.625 / 2.75)) * pos + 0.984375);
  }
};

export const easeFromTo = pos =>
  ((pos /= 0.5) < 1) ?
    0.5 * Math.pow(pos,4) :
    -0.5 * ((pos -= 2) * Math.pow(pos,3) - 2);

export const easeFrom = pos => Math.pow(pos, 4);

export const easeTo = pos => Math.pow(pos, 0.25);

{'fraction_non_alphanumeric': 0.22127486804709703, 'fraction_numerical': 0.08708891595615104, 'mean_word_length': 2.402279005524862, 'pattern_counts': {'":': 0, '<': 45, '<?xml version=': 0, '>': 44, 'https://': 2, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7462685', 'n_tokens_mistral': 4688, 'n_tokens_neox': 4168, 'n_words': 1161}