ziko 0.48.0 → 0.48.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/ziko.mjs CHANGED
@@ -2,7 +2,7 @@
2
2
  /*
3
3
  Project: ziko.js
4
4
  Author: Zakaria Elalaoui
5
- Date : Mon Nov 10 2025 12:33:51 GMT+0100 (UTC+01:00)
5
+ Date : Fri Nov 21 2025 22:08:16 GMT+0100 (UTC+01:00)
6
6
  Git-Repo : https://github.com/zakarialaoui10/ziko.js
7
7
  Git-Wiki : https://github.com/zakarialaoui10/ziko.js/wiki
8
8
  Released under MIT License
@@ -3781,27 +3781,27 @@ class Complex extends ZikoMath{
3781
3781
  this.b=a.b;
3782
3782
  }
3783
3783
  else if(typeof(a)==="object"){
3784
- if(("a" in b && "b" in a)){
3784
+ if(("a" in a && "b" in a)){
3785
3785
  this.a=a.a;
3786
3786
  this.b=a.b;
3787
3787
  }
3788
- else if(("a" in b && "z" in a)){
3788
+ else if(("a" in a && "z" in a)){
3789
3789
  this.a=a.a;
3790
3790
  this.b=sqrt$2((a.z**2)-(a.a**2));
3791
3791
  }
3792
- else if(("a" in b && "phi" in a)){
3792
+ else if(("a" in a && "phi" in a)){
3793
3793
  this.a=a.a;
3794
3794
  this.b=a.a*tan(a.phi);
3795
3795
  }
3796
- else if(("b" in b && "z" in a)){
3796
+ else if(("b" in a && "z" in a)){
3797
3797
  this.b=a.b;
3798
3798
  this.a=sqrt$2((a.z**2)-(a.b**2));
3799
3799
  }
3800
- else if(("b" in b && "phi" in a)){
3800
+ else if(("b" in a && "phi" in a)){
3801
3801
  this.b=b;
3802
3802
  this.a=a.b/tan(a.phi);
3803
3803
  }
3804
- else if(("z" in b && "phi" in a)){
3804
+ else if(("z" in a && "phi" in a)){
3805
3805
  this.a=a.z*cos$2(a.phi);
3806
3806
  this.a=a.z*sin$2(a.phi);
3807
3807
  }
@@ -3940,17 +3940,6 @@ class Complex extends ZikoMath{
3940
3940
  const de=cos$2(this.a*2)+cosh$1(this.b*2);
3941
3941
  return complex(sin$2(2*this.a)/de,sinh$1(2*this.b)/de);
3942
3942
  }
3943
- printInConsole() {
3944
- let string = this.a + " + " + this.b + " * i";
3945
- console.log(string);
3946
- return string;
3947
- }
3948
- print() {
3949
- //return text(this.a + " + i * " + this.b);
3950
- }
3951
- UI() {
3952
- return "<span>" + this.a + " + i * " + this.b + "</span>";
3953
- }
3954
3943
  }
3955
3944
  const complex=(a,b)=>{
3956
3945
  if((a instanceof Array||ArrayBuffer.isView(a)) && (b instanceof Array||ArrayBuffer.isView(a)))return a.map((n,i)=>complex(a[i],b[i]));
@@ -4078,86 +4067,127 @@ const hypot=(...x)=>{
4078
4067
  )
4079
4068
  };
4080
4069
 
4081
- const {PI, sqrt: sqrt$1, cos: cos$1, sin: sin$1, acos, pow} = Math;
4082
-
4083
- const Linear = t => t;
4084
- const InSin = t => 1 - cos$1((t * PI) / 2);
4085
- const OutSin = t => sin$1((t * PI) / 2);
4086
- const InOutSin = t => -(cos$1(PI * t) - 1) / 2;
4087
-
4088
- const InQuad = t => t**2;
4089
- const OutQuad = t => 1 - (1-t)**2;
4090
- const InOutQuad = t => t < 0.5 ? 2 * (t**2) : 1 - (-2 * t + 2)**2 / 2;
4091
-
4092
- const InCubic = t => t**3;
4093
- const OutCubic = t => 1 - (1-t)**3;
4094
- const InOutCubic = t => t < 0.5 ? 4 * (t**3) : 1 - (-2 * t + 2)**3 / 2;
4095
-
4096
- const InQuart = t => t**4;
4097
- const OutQuart = t => 1 - (1-t)**4;
4098
- const InOutQuart = t => t < 0.5 ? 8 * (t**4) : 1 - (-2 * t + 2)**4 / 2;
4099
-
4100
- const InQuint = t => t**5;
4101
- const OutQuint = t => 1 - (1-t)**5;
4102
- const InOutQuint = t => t < 0.5 ? 16 * (t**5) : 1 - (-2 * t + 2)**5 / 2;
4103
-
4104
- const InExpo = t => t === 0 ? 0 : 2**(10*t - 10);
4105
- const OutExpo = t => t === 1 ? 1 : 1 - 2**(-10 * t);
4106
- const InOutExpo = t => t === 0? 0: t === 1? 1: t < 0.5 ? 2**(20 * t - 10) / 2: (2 - 2**(-20 * t + 10)) / 2;
4107
-
4108
- const InCirc = t => 1 - sqrt$1(1 - t**2);
4109
- const OutCirc = t => sqrt$1(1 - (t-1)**2);
4110
- const InOutCirc = t => t < 0.5? (1 - sqrt$1(1 - (2*t)**2)) / 2: (sqrt$1(1 - (-2*t+2)**2) + 1) / 2;
4111
-
4112
- const Arc = t => 1 - sin$1(acos(t));
4113
- const Back = (t, x = 1) => (t**2) * ((x+1)*t - x);
4114
- const Elastic = t => -2*pow(2, 10 * (t - 1)) * cos$1(20 * PI * t / 3 * t);
4115
-
4116
- const InBack = (t, c1 = 1.70158, c3 = c1 + 1) => c3 * pow(t,3)- c1 * (t**2);
4117
- const OutBack = (t, c1 = 1.70158, c3 = c1 + 1) => 1 + c3 * pow(t - 1, 3) + c1 * pow(t - 1, 2);
4118
- const InOutBack = (t, c1 = 1.70158, c2 = c1 * 1.525) => t < 0.5 ? (pow(2 * t, 2) * ((c2 + 1) * 2 * t - c2)) / 2 : (pow(2 * t - 2, 2) * ((c2 + 1) * (t * 2 - 2) + c2) + 2) / 2;
4119
-
4120
- const InElastic = (t, c4 = 2*PI/3) => {
4121
- return t === 0
4122
- ? 0
4123
- : t === 1
4124
- ? 1
4125
- : -pow(2, 10 * t - 10) * sin$1((t * 10 - 10.75) * c4);
4126
- };
4127
-
4128
- const OutElastic = (t, c4 = 2*PI/3) => {
4129
- return t === 0
4130
- ? 0
4131
- : t === 1
4132
- ? 1
4133
- : pow(2, -10 * t) * sin$1((t * 10 - 0.75) * c4) + 1;
4134
- };
4135
- const InOutElastic = (t, c5 = 2 * PI / 4.5) => {
4136
- return t === 0
4137
- ? 0
4138
- : t === 1
4139
- ? 1
4140
- : t < 0.5
4141
- ? -(pow(2, 20 * t - 10) * sin$1((20 * t - 11.125) * c5)) / 2
4142
- : (pow(2, -20 * t + 10) * sin$1((20 * t - 11.125) * c5)) / 2 + 1;
4143
- };
4144
-
4145
- const InBounce = (t, n1 = 7.5625, d1 = 2.75) => 1 - OutBounce(1-t, n1, d1);
4146
- const OutBounce = (t, n1 = 7.5625, d1 = 2.75) => {
4147
- if(t<1/d1) return n1 * t * t;
4148
- if(t < 2 / d1) return n1 * (t -= 1.5 / d1) * t + 0.75;
4149
- if(t < 2.5 / d1) return n1 * (t -= 2.25 / d1) * t + 0.9375;
4070
+ const { PI, sqrt: sqrt$1, cos: cos$1, sin: sin$1, acos, pow } = Math;
4071
+
4072
+ const linear = t => t;
4073
+
4074
+ // --- Sin ---
4075
+ const in_sin = t => 1 - cos$1((t * PI) / 2);
4076
+ const out_sin = t => sin$1((t * PI) / 2);
4077
+ const in_out_sin = t => -(cos$1(PI * t) - 1) / 2;
4078
+
4079
+ // --- Quad ---
4080
+ const in_quad = t => t ** 2;
4081
+ const out_quad = t => 1 - (1 - t) ** 2;
4082
+ const in_out_quad = t =>
4083
+ t < 0.5 ? 2 * (t ** 2) : 1 - (-2 * t + 2) ** 2 / 2;
4084
+
4085
+ // --- Cubic ---
4086
+ const in_cubic = t => t ** 3;
4087
+ const out_cubic = t => 1 - (1 - t) ** 3;
4088
+ const in_out_cubic = t =>
4089
+ t < 0.5 ? 4 * (t ** 3) : 1 - (-2 * t + 2) ** 3 / 2;
4090
+
4091
+ // --- Quart ---
4092
+ const in_quart = t => t ** 4;
4093
+ const out_quart = t => 1 - (1 - t) ** 4;
4094
+ const in_out_quart = t =>
4095
+ t < 0.5 ? 8 * (t ** 4) : 1 - (-2 * t + 2) ** 4 / 2;
4096
+
4097
+ // --- Quint ---
4098
+ const in_quint = t => t ** 5;
4099
+ const out_quint = t => 1 - (1 - t) ** 5;
4100
+ const in_out_quint = t =>
4101
+ t < 0.5 ? 16 * (t ** 5) : 1 - (-2 * t + 2) ** 5 / 2;
4102
+
4103
+ // --- Expo ---
4104
+ const in_expo = t => (t === 0 ? 0 : 2 ** (10 * t - 10));
4105
+ const out_expo = t => (t === 1 ? 1 : 1 - 2 ** (-10 * t));
4106
+ const in_out_expo = t =>
4107
+ t === 0
4108
+ ? 0
4109
+ : t === 1
4110
+ ? 1
4111
+ : t < 0.5
4112
+ ? 2 ** (20 * t - 10) / 2
4113
+ : (2 - 2 ** (-20 * t + 10)) / 2;
4114
+
4115
+ // --- Circ ---
4116
+ const in_circ = t => 1 - sqrt$1(1 - t ** 2);
4117
+ const out_circ = t => sqrt$1(1 - (t - 1) ** 2);
4118
+ const in_out_circ = t =>
4119
+ t < 0.5
4120
+ ? (1 - sqrt$1(1 - (2 * t) ** 2)) / 2
4121
+ : (sqrt$1(1 - (-2 * t + 2) ** 2) + 1) / 2;
4122
+
4123
+ // --- Arc ---
4124
+ const arc = t => 1 - sin$1(acos(t));
4125
+
4126
+ // --- Back ---
4127
+ const back = (t, x = 1) => (t ** 2) * ((x + 1) * t - x);
4128
+
4129
+ // --- Elastic ---
4130
+ const elastic = t =>
4131
+ -2 * pow(2, 10 * (t - 1)) * cos$1((20 * PI * t) / 3 * t);
4132
+
4133
+ // --- Back variations ---
4134
+ const in_back = (t, c1 = 1.70158, c3 = c1 + 1) =>
4135
+ c3 * pow(t, 3) - c1 * (t ** 2);
4136
+
4137
+ const out_back = (t, c1 = 1.70158, c3 = c1 + 1) =>
4138
+ 1 + c3 * pow(t - 1, 3) + c1 * pow(t - 1, 2);
4139
+
4140
+ const in_out_back = (t, c1 = 1.70158, c2 = c1 * 1.525) =>
4141
+ t < 0.5
4142
+ ? (pow(2 * t, 2) * ((c2 + 1) * 2 * t - c2)) / 2
4143
+ : (pow(2 * t - 2, 2) * ((c2 + 1) * (t * 2 - 2) + c2) + 2) / 2;
4144
+
4145
+ // --- Elastic variations ---
4146
+ const in_elastic = (t, c4 = (2 * PI) / 3) =>
4147
+ t === 0
4148
+ ? 0
4149
+ : t === 1
4150
+ ? 1
4151
+ : -pow(2, 10 * t - 10) * sin$1((t * 10 - 10.75) * c4);
4152
+
4153
+ const out_elastic = (t, c4 = (2 * PI) / 3) =>
4154
+ t === 0
4155
+ ? 0
4156
+ : t === 1
4157
+ ? 1
4158
+ : pow(2, -10 * t) * sin$1((t * 10 - 0.75) * c4) + 1;
4159
+
4160
+ const in_out_elastic = (t, c5 = (2 * PI) / 4.5) =>
4161
+ t === 0
4162
+ ? 0
4163
+ : t === 1
4164
+ ? 1
4165
+ : t < 0.5
4166
+ ? -(pow(2, 20 * t - 10) * sin$1((20 * t - 11.125) * c5)) / 2
4167
+ : (pow(2, -20 * t + 10) * sin$1((20 * t - 11.125) * c5)) / 2 + 1;
4168
+
4169
+ // --- Bounce ---
4170
+ const in_bounce = (t, n1 = 7.5625, d1 = 2.75) =>
4171
+ 1 - out_bounce(1 - t, n1, d1);
4172
+
4173
+ const out_bounce = (t, n1 = 7.5625, d1 = 2.75) => {
4174
+ if (t < 1 / d1) return n1 * t * t;
4175
+ if (t < 2 / d1) return n1 * (t -= 1.5 / d1) * t + 0.75;
4176
+ if (t < 2.5 / d1) return n1 * (t -= 2.25 / d1) * t + 0.9375;
4150
4177
  return n1 * (t -= 2.625 / d1) * t + 0.984375;
4151
4178
  };
4152
4179
 
4153
- const InOutBounce = (t, n1 = 7.5625, d1 = 2.75) => t < 0.5 ? OutBounce(1 - 2 * t, n1, d1)/2 : OutBounce(2 * t - 1, n1, d1)/2;
4154
-
4180
+ const in_out_bounce = (t, n1 = 7.5625, d1 = 2.75) =>
4181
+ t < 0.5
4182
+ ? out_bounce(1 - 2 * t, n1, d1) / 2
4183
+ : out_bounce(2 * t - 1, n1, d1) / 2;
4155
4184
 
4156
- const Step = (t, steps = 5) => Math.floor(t*steps) / steps;
4157
- const Discret = (t, segments = 5) => Math.ceil(t*segments) / segments;
4185
+ // --- Step / Discrete ---
4186
+ const step = (t, steps = 5) => Math.floor(t * steps) / steps;
4187
+ const discret = (t, segments = 5) => Math.ceil(t * segments) / segments;
4158
4188
 
4159
4189
  class TimeAnimation {
4160
- constructor(callback, { ease = Linear, step = 50, t0 = 0, start = true, duration = 3000 } = {}) {
4190
+ constructor(callback, { ease = linear, step = 50, t0 = 0, start = true, duration = 3000 } = {}) {
4161
4191
  this.callback = callback;
4162
4192
  this.state = {
4163
4193
  isRunning: false,
@@ -5359,4 +5389,4 @@ if(globalThis?.document){
5359
5389
  document?.addEventListener("DOMContentLoaded", __Ziko__.__Config__.init());
5360
5390
  }
5361
5391
 
5362
- export { App, Arc, Back, Base, Clock, Combinaison, Complex, Discret, E, EPSILON, Elastic, FileBasedRouting, Flex, HTMLWrapper, InBack, InBounce, InCirc, InCubic, InElastic, InExpo, InOutBack, InOutBounce, InOutCirc, InOutCubic, InOutElastic, InOutExpo, InOutQuad, InOutQuart, InOutQuint, InOutSin, InQuad, InQuart, InQuint, InSin, Linear, Logic$1 as Logic, Matrix, OutBack, OutBounce, OutCirc, OutCubic, OutElastic, OutExpo, OutQuad, OutQuart, OutQuint, OutSin, PI$2 as PI, Permutation, Random, SPA, SVGWrapper, Scheduler, Step, Suspense, Switch, Tick, TimeAnimation, TimeLoop, TimeScheduler, UIElement$1 as UIElement, UIHTMLWrapper, UINode, UISVGWrapper, UISwitch, UIView, Utils, View, ZikoApp, ZikoEventClick, ZikoEventClipboard, ZikoEventCustom, ZikoEventDrag, ZikoEventFocus, ZikoEventHash, ZikoEventKey, ZikoEventMouse, ZikoEventPointer, ZikoEventTouch, ZikoEventWheel, ZikoSPA, ZikoUIFlex, ZikoUISuspense, ZikoUIText, ZikoUseRoot, __ZikoEvent__, abs, accum, acos$1 as acos, acosh, acot, add, animation, arange, arr2str, asin, asinh, atan, atan2, atanh, bindCustomEvent, bindHashEvent, bindTouchEvent, bind_click_event, bind_clipboard_event, bind_drag_event, bind_focus_event, bind_key_event, bind_mouse_event, bind_pointer_event, bind_wheel_event, cartesianProduct, ceil, clamp, clock, combinaison, complex, cos$2 as cos, cosh$1 as cosh, cot, coth, csc, csv2arr, csv2json, csv2matrix, csv2object, csv2sql, debounce, defineParamsGetter, define_wc, deg2rad, div, e, fact, floor, geomspace, getEvent, hypot, inRange, isApproximatlyEqual, isStateGetter, json2arr, json2css, json2csv, json2csvFile, json2xml, json2xmlFile, json2yml, json2ymlFile, lerp, linspace, ln, logspace, loop, map$1 as map, mapfun$1 as mapfun, matrix, matrix2, matrix3, matrix4, max, min, modulo, mul, norm, nums, obj2str, ones, pgcd, pow$1 as pow, powerSet, ppcm, preload, prod, rad2deg, round, sec, sig, sign, sin$2 as sin, sinc, sinh$1 as sinh, sleep, sqrt$2 as sqrt, sqrtn, step_fps, sub, subSet, sum, svg2ascii, svg2img, svg2imgUrl, svg2str, tags, tan, tanh, text, throttle, tick, timeTaken, time_memory_Taken, timeout, useChannel, useDerived, useEventEmitter, useLocaleStorage, useReactive, useRoot, useSessionStorage, useState, useThread, wait, waitForUIElm, waitForUIElmSync, zeros };
5392
+ export { App, Base, Clock, Combinaison, Complex, E, EPSILON, FileBasedRouting, Flex, HTMLWrapper, Logic$1 as Logic, Matrix, PI$2 as PI, Permutation, Random, SPA, SVGWrapper, Scheduler, Suspense, Switch, Tick, TimeAnimation, TimeLoop, TimeScheduler, UIElement$1 as UIElement, UIHTMLWrapper, UINode, UISVGWrapper, UISwitch, UIView, Utils, View, ZikoApp, ZikoEventClick, ZikoEventClipboard, ZikoEventCustom, ZikoEventDrag, ZikoEventFocus, ZikoEventHash, ZikoEventKey, ZikoEventMouse, ZikoEventPointer, ZikoEventTouch, ZikoEventWheel, ZikoSPA, ZikoUIFlex, ZikoUISuspense, ZikoUIText, ZikoUseRoot, __ZikoEvent__, abs, accum, acos$1 as acos, acosh, acot, add, animation, arange, arc, arr2str, asin, asinh, atan, atan2, atanh, back, bindCustomEvent, bindHashEvent, bindTouchEvent, bind_click_event, bind_clipboard_event, bind_drag_event, bind_focus_event, bind_key_event, bind_mouse_event, bind_pointer_event, bind_wheel_event, cartesianProduct, ceil, clamp, clock, combinaison, complex, cos$2 as cos, cosh$1 as cosh, cot, coth, csc, csv2arr, csv2json, csv2matrix, csv2object, csv2sql, debounce, defineParamsGetter, define_wc, deg2rad, discret, div, e, elastic, fact, floor, geomspace, getEvent, hypot, inRange, in_back, in_bounce, in_circ, in_cubic, in_elastic, in_expo, in_out_back, in_out_bounce, in_out_circ, in_out_cubic, in_out_elastic, in_out_expo, in_out_quad, in_out_quart, in_out_quint, in_out_sin, in_quad, in_quart, in_quint, in_sin, isApproximatlyEqual, isStateGetter, json2arr, json2css, json2csv, json2csvFile, json2xml, json2xmlFile, json2yml, json2ymlFile, lerp, linear, linspace, ln, logspace, loop, map$1 as map, mapfun$1 as mapfun, matrix, matrix2, matrix3, matrix4, max, min, modulo, mul, norm, nums, obj2str, ones, out_back, out_bounce, out_circ, out_cubic, out_elastic, out_expo, out_quad, out_quart, out_quint, out_sin, pgcd, pow$1 as pow, powerSet, ppcm, preload, prod, rad2deg, round, sec, sig, sign, sin$2 as sin, sinc, sinh$1 as sinh, sleep, sqrt$2 as sqrt, sqrtn, step, step_fps, sub, subSet, sum, svg2ascii, svg2img, svg2imgUrl, svg2str, tags, tan, tanh, text, throttle, tick, timeTaken, time_memory_Taken, timeout, useChannel, useDerived, useEventEmitter, useLocaleStorage, useReactive, useRoot, useSessionStorage, useState, useThread, wait, waitForUIElm, waitForUIElmSync, zeros };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ziko",
3
- "version": "0.48.0",
3
+ "version": "0.48.2",
4
4
  "description": "A versatile JavaScript library offering a rich set of Hyperscript Based UI components, advanced mathematical utilities, interactivity ,animations, client side routing and more ...",
5
5
  "keywords": [
6
6
  "front-end",
@@ -24,16 +24,17 @@
24
24
  "types",
25
25
  "LICENCE"
26
26
  ],
27
- "types": "./types/global.d.ts",
28
27
  "exports": {
29
- "./*": "./src/*",
28
+ "./*": {
29
+ "import" : "./src/*/index.js",
30
+ "types" : "./types/*/index.d.ts"
31
+ },
30
32
  ".": {
31
33
  "import": "./dist/ziko.mjs",
32
- "require": "./dist/ziko.cjs"
33
- },
34
- "./math": {
35
- "import": "./src/math/index.js"
34
+ "require": "./dist/ziko.cjs",
35
+ "types" : "./types/index.d.ts"
36
36
  },
37
+
37
38
  "./helpers": {
38
39
  "import": "./src/__helpers__.js"
39
40
  },
@@ -59,7 +60,6 @@
59
60
  "./src": "./src/index.js",
60
61
  "./html": {},
61
62
  "./app": {},
62
- "./time": {},
63
63
  "./components": {}
64
64
  },
65
65
  "sideEffects" : true,
File without changes
@@ -23,27 +23,27 @@ class Complex extends ZikoMath{
23
23
  this.b=a.b;
24
24
  }
25
25
  else if(typeof(a)==="object"){
26
- if(("a" in b && "b" in a)){
26
+ if(("a" in a && "b" in a)){
27
27
  this.a=a.a;
28
28
  this.b=a.b;
29
29
  }
30
- else if(("a" in b && "z" in a)){
30
+ else if(("a" in a && "z" in a)){
31
31
  this.a=a.a;
32
32
  this.b=sqrt((a.z**2)-(a.a**2));
33
33
  }
34
- else if(("a" in b && "phi" in a)){
34
+ else if(("a" in a && "phi" in a)){
35
35
  this.a=a.a;
36
36
  this.b=a.a*tan(a.phi);
37
37
  }
38
- else if(("b" in b && "z" in a)){
38
+ else if(("b" in a && "z" in a)){
39
39
  this.b=a.b;
40
40
  this.a=sqrt((a.z**2)-(a.b**2));
41
41
  }
42
- else if(("b" in b && "phi" in a)){
42
+ else if(("b" in a && "phi" in a)){
43
43
  this.b=b;
44
44
  this.a=a.b/tan(a.phi);
45
45
  }
46
- else if(("z" in b && "phi" in a)){
46
+ else if(("z" in a && "phi" in a)){
47
47
  this.a=a.z*cos(a.phi);
48
48
  this.a=a.z*sin(a.phi);
49
49
  }
@@ -182,17 +182,6 @@ class Complex extends ZikoMath{
182
182
  const de=cos(this.a*2)+cosh(this.b*2);
183
183
  return complex(sin(2*this.a)/de,sinh(2*this.b)/de);
184
184
  }
185
- printInConsole() {
186
- let string = this.a + " + " + this.b + " * i";
187
- console.log(string);
188
- return string;
189
- }
190
- print() {
191
- //return text(this.a + " + i * " + this.b);
192
- }
193
- UI() {
194
- return "<span>" + this.a + " + i * " + this.b + "</span>";
195
- }
196
185
  }
197
186
  const complex=(a,b)=>{
198
187
  if((a instanceof Array||ArrayBuffer.isView(a)) && (b instanceof Array||ArrayBuffer.isView(a)))return a.map((n,i)=>complex(a[i],b[i]));
@@ -1,8 +1,8 @@
1
- import { Linear } from "../ease/index.js";
1
+ import { linear } from "../ease/index.js";
2
2
  import { map } from "../../math/utils/index.js";
3
3
 
4
4
  class TimeAnimation {
5
- constructor(callback, { ease = Linear, step = 50, t0 = 0, start = true, duration = 3000 } = {}) {
5
+ constructor(callback, { ease = linear, step = 50, t0 = 0, start = true, duration = 3000 } = {}) {
6
6
  this.callback = callback;
7
7
  this.state = {
8
8
  isRunning: false,
@@ -1,77 +1,118 @@
1
- const {PI, sqrt, cos, sin, acos, pow} = Math;
2
-
3
- export const Linear = t => t
4
- export const InSin = t => 1 - cos((t * PI) / 2);
5
- export const OutSin = t => sin((t * PI) / 2);
6
- export const InOutSin = t => -(cos(PI * t) - 1) / 2;
7
-
8
- export const InQuad = t => t**2;
9
- export const OutQuad = t => 1 - (1-t)**2;
10
- export const InOutQuad = t => t < 0.5 ? 2 * (t**2) : 1 - (-2 * t + 2)**2 / 2;
11
-
12
- export const InCubic = t => t**3;
13
- export const OutCubic = t => 1 - (1-t)**3;
14
- export const InOutCubic = t => t < 0.5 ? 4 * (t**3) : 1 - (-2 * t + 2)**3 / 2;
15
-
16
- export const InQuart = t => t**4;
17
- export const OutQuart = t => 1 - (1-t)**4;
18
- export const InOutQuart = t => t < 0.5 ? 8 * (t**4) : 1 - (-2 * t + 2)**4 / 2;
19
-
20
- export const InQuint = t => t**5;
21
- export const OutQuint = t => 1 - (1-t)**5;
22
- export const InOutQuint = t => t < 0.5 ? 16 * (t**5) : 1 - (-2 * t + 2)**5 / 2;
23
-
24
- export const InExpo = t => t === 0 ? 0 : 2**(10*t - 10)
25
- export const OutExpo = t => t === 1 ? 1 : 1 - 2**(-10 * t)
26
- export const InOutExpo = t => t === 0? 0: t === 1? 1: t < 0.5 ? 2**(20 * t - 10) / 2: (2 - 2**(-20 * t + 10)) / 2;
27
-
28
- export const InCirc = t => 1 - sqrt(1 - t**2);
29
- export const OutCirc = t => sqrt(1 - (t-1)**2);
30
- export const InOutCirc = t => t < 0.5? (1 - sqrt(1 - (2*t)**2)) / 2: (sqrt(1 - (-2*t+2)**2) + 1) / 2;
31
-
32
- export const Arc = t => 1 - sin(acos(t));
33
- export const Back = (t, x = 1) => (t**2) * ((x+1)*t - x);
34
- export const Elastic = t => -2*pow(2, 10 * (t - 1)) * cos(20 * PI * t / 3 * t);
35
-
36
- export const InBack = (t, c1 = 1.70158, c3 = c1 + 1) => c3 * pow(t,3)- c1 * (t**2);
37
- export const OutBack = (t, c1 = 1.70158, c3 = c1 + 1) => 1 + c3 * pow(t - 1, 3) + c1 * pow(t - 1, 2);
38
- export const InOutBack = (t, c1 = 1.70158, c2 = c1 * 1.525) => t < 0.5 ? (pow(2 * t, 2) * ((c2 + 1) * 2 * t - c2)) / 2 : (pow(2 * t - 2, 2) * ((c2 + 1) * (t * 2 - 2) + c2) + 2) / 2;
39
-
40
- export const InElastic = (t, c4 = 2*PI/3) => {
41
- return t === 0
42
- ? 0
43
- : t === 1
44
- ? 1
45
- : -pow(2, 10 * t - 10) * sin((t * 10 - 10.75) * c4);
46
- }
47
-
48
- export const OutElastic = (t, c4 = 2*PI/3) => {
49
- return t === 0
50
- ? 0
51
- : t === 1
52
- ? 1
53
- : pow(2, -10 * t) * sin((t * 10 - 0.75) * c4) + 1;
54
- }
55
- export const InOutElastic = (t, c5 = 2 * PI / 4.5) => {
56
- return t === 0
57
- ? 0
58
- : t === 1
59
- ? 1
60
- : t < 0.5
61
- ? -(pow(2, 20 * t - 10) * sin((20 * t - 11.125) * c5)) / 2
62
- : (pow(2, -20 * t + 10) * sin((20 * t - 11.125) * c5)) / 2 + 1;
63
- }
64
-
65
- export const InBounce = (t, n1 = 7.5625, d1 = 2.75) => 1 - OutBounce(1-t, n1, d1);
66
- export const OutBounce = (t, n1 = 7.5625, d1 = 2.75) => {
67
- if(t<1/d1) return n1 * t * t;
68
- if(t < 2 / d1) return n1 * (t -= 1.5 / d1) * t + 0.75;
69
- if(t < 2.5 / d1) return n1 * (t -= 2.25 / d1) * t + 0.9375;
70
- return n1 * (t -= 2.625 / d1) * t + 0.984375;
71
- }
1
+ const { PI, sqrt, cos, sin, acos, pow } = Math;
2
+
3
+ export const linear = t => t;
4
+
5
+ // --- Sin ---
6
+ export const in_sin = t => 1 - cos((t * PI) / 2);
7
+ export const out_sin = t => sin((t * PI) / 2);
8
+ export const in_out_sin = t => -(cos(PI * t) - 1) / 2;
9
+
10
+ // --- Quad ---
11
+ export const in_quad = t => t ** 2;
12
+ export const out_quad = t => 1 - (1 - t) ** 2;
13
+ export const in_out_quad = t =>
14
+ t < 0.5 ? 2 * (t ** 2) : 1 - (-2 * t + 2) ** 2 / 2;
15
+
16
+ // --- Cubic ---
17
+ export const in_cubic = t => t ** 3;
18
+ export const out_cubic = t => 1 - (1 - t) ** 3;
19
+ export const in_out_cubic = t =>
20
+ t < 0.5 ? 4 * (t ** 3) : 1 - (-2 * t + 2) ** 3 / 2;
21
+
22
+ // --- Quart ---
23
+ export const in_quart = t => t ** 4;
24
+ export const out_quart = t => 1 - (1 - t) ** 4;
25
+ export const in_out_quart = t =>
26
+ t < 0.5 ? 8 * (t ** 4) : 1 - (-2 * t + 2) ** 4 / 2;
27
+
28
+ // --- Quint ---
29
+ export const in_quint = t => t ** 5;
30
+ export const out_quint = t => 1 - (1 - t) ** 5;
31
+ export const in_out_quint = t =>
32
+ t < 0.5 ? 16 * (t ** 5) : 1 - (-2 * t + 2) ** 5 / 2;
33
+
34
+ // --- Expo ---
35
+ export const in_expo = t => (t === 0 ? 0 : 2 ** (10 * t - 10));
36
+ export const out_expo = t => (t === 1 ? 1 : 1 - 2 ** (-10 * t));
37
+ export const in_out_expo = t =>
38
+ t === 0
39
+ ? 0
40
+ : t === 1
41
+ ? 1
42
+ : t < 0.5
43
+ ? 2 ** (20 * t - 10) / 2
44
+ : (2 - 2 ** (-20 * t + 10)) / 2;
45
+
46
+ // --- Circ ---
47
+ export const in_circ = t => 1 - sqrt(1 - t ** 2);
48
+ export const out_circ = t => sqrt(1 - (t - 1) ** 2);
49
+ export const in_out_circ = t =>
50
+ t < 0.5
51
+ ? (1 - sqrt(1 - (2 * t) ** 2)) / 2
52
+ : (sqrt(1 - (-2 * t + 2) ** 2) + 1) / 2;
53
+
54
+ // --- Arc ---
55
+ export const arc = t => 1 - sin(acos(t));
72
56
 
73
- export const InOutBounce = (t, n1 = 7.5625, d1 = 2.75) => t < 0.5 ? OutBounce(1 - 2 * t, n1, d1)/2 : OutBounce(2 * t - 1, n1, d1)/2
57
+ // --- Back ---
58
+ export const back = (t, x = 1) => (t ** 2) * ((x + 1) * t - x);
59
+
60
+ // --- Elastic ---
61
+ export const elastic = t =>
62
+ -2 * pow(2, 10 * (t - 1)) * cos((20 * PI * t) / 3 * t);
63
+
64
+ // --- Back variations ---
65
+ export const in_back = (t, c1 = 1.70158, c3 = c1 + 1) =>
66
+ c3 * pow(t, 3) - c1 * (t ** 2);
67
+
68
+ export const out_back = (t, c1 = 1.70158, c3 = c1 + 1) =>
69
+ 1 + c3 * pow(t - 1, 3) + c1 * pow(t - 1, 2);
70
+
71
+ export const in_out_back = (t, c1 = 1.70158, c2 = c1 * 1.525) =>
72
+ t < 0.5
73
+ ? (pow(2 * t, 2) * ((c2 + 1) * 2 * t - c2)) / 2
74
+ : (pow(2 * t - 2, 2) * ((c2 + 1) * (t * 2 - 2) + c2) + 2) / 2;
75
+
76
+ // --- Elastic variations ---
77
+ export const in_elastic = (t, c4 = (2 * PI) / 3) =>
78
+ t === 0
79
+ ? 0
80
+ : t === 1
81
+ ? 1
82
+ : -pow(2, 10 * t - 10) * sin((t * 10 - 10.75) * c4);
83
+
84
+ export const out_elastic = (t, c4 = (2 * PI) / 3) =>
85
+ t === 0
86
+ ? 0
87
+ : t === 1
88
+ ? 1
89
+ : pow(2, -10 * t) * sin((t * 10 - 0.75) * c4) + 1;
90
+
91
+ export const in_out_elastic = (t, c5 = (2 * PI) / 4.5) =>
92
+ t === 0
93
+ ? 0
94
+ : t === 1
95
+ ? 1
96
+ : t < 0.5
97
+ ? -(pow(2, 20 * t - 10) * sin((20 * t - 11.125) * c5)) / 2
98
+ : (pow(2, -20 * t + 10) * sin((20 * t - 11.125) * c5)) / 2 + 1;
99
+
100
+ // --- Bounce ---
101
+ export const in_bounce = (t, n1 = 7.5625, d1 = 2.75) =>
102
+ 1 - out_bounce(1 - t, n1, d1);
103
+
104
+ export const out_bounce = (t, n1 = 7.5625, d1 = 2.75) => {
105
+ if (t < 1 / d1) return n1 * t * t;
106
+ if (t < 2 / d1) return n1 * (t -= 1.5 / d1) * t + 0.75;
107
+ if (t < 2.5 / d1) return n1 * (t -= 2.25 / d1) * t + 0.9375;
108
+ return n1 * (t -= 2.625 / d1) * t + 0.984375;
109
+ };
74
110
 
111
+ export const in_out_bounce = (t, n1 = 7.5625, d1 = 2.75) =>
112
+ t < 0.5
113
+ ? out_bounce(1 - 2 * t, n1, d1) / 2
114
+ : out_bounce(2 * t - 1, n1, d1) / 2;
75
115
 
76
- export const Step = (t, steps = 5) => Math.floor(t*steps) / steps;
77
- export const Discret = (t, segments = 5) => Math.ceil(t*segments) / segments;
116
+ // --- Step / Discrete ---
117
+ export const step = (t, steps = 5) => Math.floor(t * steps) / steps;
118
+ export const discret = (t, segments = 5) => Math.ceil(t * segments) / segments;
@@ -0,0 +1,2 @@
1
+ export type * from './math'
2
+ export type * from './time'
@@ -0,0 +1,52 @@
1
+ export declare class Complex {
2
+ a: number;
3
+ b: number;
4
+
5
+ constructor(a?: number, b?: number);
6
+ constructor(c: Complex);
7
+ constructor(a:
8
+ { a: number; b: number } |
9
+ { a: number; z: number } |
10
+ { a: number; phi: number } |
11
+ { b: number; z: number } |
12
+ { b: number; phi: number } |
13
+ { z: number; phi: number }
14
+ );
15
+ constructor();
16
+
17
+ isComplex(): true;
18
+ toString(): string;
19
+
20
+ readonly clone: Complex;
21
+ readonly z: number;
22
+ readonly phi: number;
23
+ readonly conj: Complex;
24
+ readonly inv: Complex;
25
+ readonly sqrt: Complex;
26
+ readonly log: Complex;
27
+ readonly cos: Complex;
28
+ readonly sin: Complex;
29
+ readonly tan: Complex;
30
+ expo: [number, number];
31
+
32
+ add(...z: (number | Complex)[]): this;
33
+ sub(...z: (number | Complex)[]): this;
34
+ mul(...z: (number | Complex)[]): this;
35
+ div(...z: (number | Complex)[]): this;
36
+ pow(n: number): this;
37
+ sqrtn(n?: number): Complex;
38
+
39
+ static Zero(): Complex;
40
+ static fromExpo(z: number, phi: number): Complex;
41
+ static add(c: Complex, ...z: (number | Complex)[]): Complex;
42
+ static sub(c: Complex, ...z: (number | Complex)[]): Complex;
43
+ static mul(c: Complex, ...z: (number | Complex)[]): Complex;
44
+ static div(c: Complex, ...z: (number | Complex)[]): Complex;
45
+ static pow(c: Complex, n: number): Complex;
46
+ static xpowZ(x: number): Complex;
47
+ }
48
+
49
+ export declare function complex(a: number, b?: number): Complex;
50
+ export declare function complex(a: Complex): Complex;
51
+ export declare function complex(a: object): Complex;
52
+ export declare function complex(): Complex;
@@ -0,0 +1,2 @@
1
+ export * from "./complex"
2
+ export * from './utils'
@@ -0,0 +1 @@
1
+ export type * from './mapfun'