poly.js 596 B

12345678910111213141516171819202122232425262728293031323334353637
  1. var exponent = 3;
  2. export var polyIn = (function custom(e) {
  3. e = +e;
  4. function polyIn(t) {
  5. return Math.pow(t, e);
  6. }
  7. polyIn.exponent = custom;
  8. return polyIn;
  9. })(exponent);
  10. export var polyOut = (function custom(e) {
  11. e = +e;
  12. function polyOut(t) {
  13. return 1 - Math.pow(1 - t, e);
  14. }
  15. polyOut.exponent = custom;
  16. return polyOut;
  17. })(exponent);
  18. export var polyInOut = (function custom(e) {
  19. e = +e;
  20. function polyInOut(t) {
  21. return ((t *= 2) <= 1 ? Math.pow(t, e) : 2 - Math.pow(2 - t, e)) / 2;
  22. }
  23. polyInOut.exponent = custom;
  24. return polyInOut;
  25. })(exponent);