PHP 7.4.33
Preview: elastic.js Size: 1.26 KB
/var/www/sitesecurity.bitkit.dk/httpdocs/node_modules/d3-ease/src/elastic.js
import {tpmt} from "./math.js";

var tau = 2 * Math.PI,
    amplitude = 1,
    period = 0.3;

export 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);

export 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);

export 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);

Directory Contents

Dirs: 0 × Files: 12
Name Size Perms Modified Actions
660 B lrw-r--r-- 2026-04-28 09:11:39
Edit Download
521 B lrw-r--r-- 2026-04-28 09:11:39
Edit Download
261 B lrw-r--r-- 2026-04-28 09:11:39
Edit Download
210 B lrw-r--r-- 2026-04-28 09:11:39
Edit Download
1.26 KB lrw-r--r-- 2026-04-28 09:11:40
Edit Download
233 B lrw-r--r-- 2026-04-28 09:11:40
Edit Download
1.28 KB lrw-r--r-- 2026-04-28 09:11:40
Edit Download
31 B lrw-r--r-- 2026-04-28 09:11:40
Edit Download
152 B lrw-r--r-- 2026-04-28 09:11:40
Edit Download
596 B lrw-r--r-- 2026-04-28 09:11:40
Edit Download
192 B lrw-r--r-- 2026-04-28 09:11:40
Edit Download
253 B lrw-r--r-- 2026-04-28 09:11:40
Edit Download
If ZipArchive is unavailable, a .tar will be created (no compression).