source: node_modules/victory-vendor/lib-vendor/d3-ease/src/elastic.js

Last change on this file was a762898, checked in by istevanoska <ilinastevanoska@…>, 6 months ago

Added visualizations

  • Property mode set to 100644
File size: 1.5 KB
Line 
1"use strict";
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6exports.elasticOut = exports.elasticInOut = exports.elasticIn = void 0;
7var _math = require("./math.js");
8var tau = 2 * Math.PI,
9 amplitude = 1,
10 period = 0.3;
11var elasticIn = exports.elasticIn = function custom(a, p) {
12 var s = Math.asin(1 / (a = Math.max(1, a))) * (p /= tau);
13 function elasticIn(t) {
14 return a * (0, _math.tpmt)(- --t) * Math.sin((s - t) / p);
15 }
16 elasticIn.amplitude = function (a) {
17 return custom(a, p * tau);
18 };
19 elasticIn.period = function (p) {
20 return custom(a, p);
21 };
22 return elasticIn;
23}(amplitude, period);
24var elasticOut = exports.elasticOut = function custom(a, p) {
25 var s = Math.asin(1 / (a = Math.max(1, a))) * (p /= tau);
26 function elasticOut(t) {
27 return 1 - a * (0, _math.tpmt)(t = +t) * Math.sin((t + s) / p);
28 }
29 elasticOut.amplitude = function (a) {
30 return custom(a, p * tau);
31 };
32 elasticOut.period = function (p) {
33 return custom(a, p);
34 };
35 return elasticOut;
36}(amplitude, period);
37var elasticInOut = exports.elasticInOut = function custom(a, p) {
38 var s = Math.asin(1 / (a = Math.max(1, a))) * (p /= tau);
39 function elasticInOut(t) {
40 return ((t = t * 2 - 1) < 0 ? a * (0, _math.tpmt)(-t) * Math.sin((s - t) / p) : 2 - a * (0, _math.tpmt)(t) * Math.sin((s + t) / p)) / 2;
41 }
42 elasticInOut.amplitude = function (a) {
43 return custom(a, p * tau);
44 };
45 elasticInOut.period = function (p) {
46 return custom(a, p);
47 };
48 return elasticInOut;
49}(amplitude, period);
Note: See TracBrowser for help on using the repository browser.