@pawells/math-extended 1.0.4 → 1.1.1
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/README.md +5 -5
- package/build/angles.d.ts +33 -3
- package/build/angles.d.ts.map +1 -1
- package/build/angles.js +57 -35
- package/build/angles.js.map +1 -1
- package/build/interpolation.d.ts +378 -63
- package/build/interpolation.d.ts.map +1 -1
- package/build/interpolation.js +380 -63
- package/build/interpolation.js.map +1 -1
- package/build/matrices/asserts.d.ts +12 -15
- package/build/matrices/asserts.d.ts.map +1 -1
- package/build/matrices/asserts.js +12 -15
- package/build/matrices/asserts.js.map +1 -1
- package/build/matrices/core.d.ts +11 -12
- package/build/matrices/core.d.ts.map +1 -1
- package/build/matrices/core.js +11 -12
- package/build/matrices/core.js.map +1 -1
- package/build/matrices/decompositions.d.ts +23 -24
- package/build/matrices/decompositions.d.ts.map +1 -1
- package/build/matrices/decompositions.js +85 -141
- package/build/matrices/decompositions.js.map +1 -1
- package/build/matrices/linear-algebra.d.ts +6 -1
- package/build/matrices/linear-algebra.d.ts.map +1 -1
- package/build/matrices/linear-algebra.js +54 -19
- package/build/matrices/linear-algebra.js.map +1 -1
- package/build/matrices/transformations.d.ts +9 -12
- package/build/matrices/transformations.d.ts.map +1 -1
- package/build/matrices/transformations.js +9 -12
- package/build/matrices/transformations.js.map +1 -1
- package/build/quaternions/core.d.ts +6 -2
- package/build/quaternions/core.d.ts.map +1 -1
- package/build/quaternions/core.js +17 -10
- package/build/quaternions/core.js.map +1 -1
- package/build/random.d.ts +10 -2
- package/build/random.d.ts.map +1 -1
- package/build/random.js +25 -17
- package/build/random.js.map +1 -1
- package/build/vectors/core.d.ts.map +1 -1
- package/build/vectors/core.js +5 -9
- package/build/vectors/core.js.map +1 -1
- package/package.json +11 -14
package/build/interpolation.d.ts
CHANGED
|
@@ -16,159 +16,474 @@
|
|
|
16
16
|
*/
|
|
17
17
|
export declare function LinearInterpolation(a: number, b: number, t: number): number;
|
|
18
18
|
/**
|
|
19
|
-
* Smooth step interpolation (3t²
|
|
20
|
-
* Provides smooth acceleration and deceleration with zero derivatives at endpoints
|
|
19
|
+
* Smooth step interpolation (3t² − 2t³).
|
|
20
|
+
* Provides smooth acceleration and deceleration with zero first derivatives at both endpoints.
|
|
21
|
+
*
|
|
22
|
+
* @param a - Start value (result when t = 0)
|
|
23
|
+
* @param b - End value (result when t = 1)
|
|
24
|
+
* @param t - Interpolation parameter — unclamped, allowing extrapolation
|
|
25
|
+
* @returns Interpolated value using cubic smooth-step curve
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* SmoothStep(0, 10, 0) // 0
|
|
29
|
+
* SmoothStep(0, 10, 1) // 10
|
|
30
|
+
* SmoothStep(0, 10, 0.25) // 1.5625 (slower start than LinearInterpolation's 2.5)
|
|
21
31
|
*/
|
|
22
32
|
export declare function SmoothStep(a: number, b: number, t: number): number;
|
|
23
33
|
/**
|
|
24
|
-
* Smoother step interpolation (6t⁵
|
|
25
|
-
* Even smoother than SmoothStep with zero first and second derivatives at endpoints
|
|
34
|
+
* Smoother step interpolation (6t⁵ − 15t⁴ + 10t³).
|
|
35
|
+
* Even smoother than SmoothStep with zero first and second derivatives at both endpoints
|
|
36
|
+
* (Ken Perlin's improvement).
|
|
37
|
+
*
|
|
38
|
+
* @param a - Start value (result when t = 0)
|
|
39
|
+
* @param b - End value (result when t = 1)
|
|
40
|
+
* @param t - Interpolation parameter — unclamped, allowing extrapolation
|
|
41
|
+
* @returns Interpolated value using quintic smoother-step curve
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* SmootherStep(0, 10, 0) // 0
|
|
45
|
+
* SmootherStep(0, 10, 1) // 10
|
|
46
|
+
* SmootherStep(0, 10, 0.25) // ~1.04 (smoother start than SmoothStep)
|
|
26
47
|
*/
|
|
27
48
|
export declare function SmootherStep(a: number, b: number, t: number): number;
|
|
28
49
|
/**
|
|
29
|
-
* Quadratic ease-in interpolation (t²)
|
|
30
|
-
* Accelerates slowly
|
|
50
|
+
* Quadratic ease-in interpolation (t²).
|
|
51
|
+
* Accelerates from rest — starts slowly and gains speed toward the end.
|
|
52
|
+
*
|
|
53
|
+
* @param a - Start value (result when t = 0)
|
|
54
|
+
* @param b - End value (result when t = 1)
|
|
55
|
+
* @param t - Interpolation parameter — unclamped, allowing extrapolation
|
|
56
|
+
* @returns Interpolated value with quadratic acceleration from start
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* QuadraticEaseIn(0, 10, 0) // 0
|
|
60
|
+
* QuadraticEaseIn(0, 10, 1) // 10
|
|
61
|
+
* QuadraticEaseIn(0, 10, 0.5) // 2.5 (only 25% progress at the midpoint)
|
|
31
62
|
*/
|
|
32
63
|
export declare function QuadraticEaseIn(a: number, b: number, t: number): number;
|
|
33
64
|
/**
|
|
34
|
-
* Quadratic ease-out interpolation (1
|
|
35
|
-
* Decelerates
|
|
65
|
+
* Quadratic ease-out interpolation (1 − (1−t)²).
|
|
66
|
+
* Decelerates to rest — starts quickly and slows toward the end.
|
|
67
|
+
*
|
|
68
|
+
* @param a - Start value (result when t = 0)
|
|
69
|
+
* @param b - End value (result when t = 1)
|
|
70
|
+
* @param t - Interpolation parameter — unclamped, allowing extrapolation
|
|
71
|
+
* @returns Interpolated value with quadratic deceleration toward end
|
|
72
|
+
*
|
|
73
|
+
* @example
|
|
74
|
+
* QuadraticEaseOut(0, 10, 0) // 0
|
|
75
|
+
* QuadraticEaseOut(0, 10, 1) // 10
|
|
76
|
+
* QuadraticEaseOut(0, 10, 0.5) // 7.5 (already 75% progress at the midpoint)
|
|
36
77
|
*/
|
|
37
78
|
export declare function QuadraticEaseOut(a: number, b: number, t: number): number;
|
|
38
79
|
/**
|
|
39
|
-
* Cubic ease-in interpolation (t³)
|
|
40
|
-
* More pronounced acceleration than quadratic
|
|
80
|
+
* Cubic ease-in interpolation (t³).
|
|
81
|
+
* More pronounced acceleration than quadratic — starts very slowly.
|
|
82
|
+
*
|
|
83
|
+
* @param a - Start value (result when t = 0)
|
|
84
|
+
* @param b - End value (result when t = 1)
|
|
85
|
+
* @param t - Interpolation parameter — unclamped, allowing extrapolation
|
|
86
|
+
* @returns Interpolated value with cubic acceleration from start
|
|
87
|
+
*
|
|
88
|
+
* @example
|
|
89
|
+
* CubicEaseIn(0, 10, 0) // 0
|
|
90
|
+
* CubicEaseIn(0, 10, 1) // 10
|
|
91
|
+
* CubicEaseIn(0, 10, 0.5) // 1.25 (only 12.5% progress at the midpoint)
|
|
41
92
|
*/
|
|
42
93
|
export declare function CubicEaseIn(a: number, b: number, t: number): number;
|
|
43
94
|
/**
|
|
44
|
-
* Cubic ease-out interpolation (1
|
|
45
|
-
* More pronounced deceleration than quadratic
|
|
95
|
+
* Cubic ease-out interpolation (1 − (1−t)³).
|
|
96
|
+
* More pronounced deceleration than quadratic — slows very gradually at the end.
|
|
97
|
+
*
|
|
98
|
+
* @param a - Start value (result when t = 0)
|
|
99
|
+
* @param b - End value (result when t = 1)
|
|
100
|
+
* @param t - Interpolation parameter — unclamped, allowing extrapolation
|
|
101
|
+
* @returns Interpolated value with cubic deceleration toward end
|
|
102
|
+
*
|
|
103
|
+
* @example
|
|
104
|
+
* CubicEaseOut(0, 10, 0) // 0
|
|
105
|
+
* CubicEaseOut(0, 10, 1) // 10
|
|
106
|
+
* CubicEaseOut(0, 10, 0.5) // 8.75 (already 87.5% progress at the midpoint)
|
|
46
107
|
*/
|
|
47
108
|
export declare function CubicEaseOut(a: number, b: number, t: number): number;
|
|
48
109
|
/**
|
|
49
|
-
* Cosine interpolation
|
|
50
|
-
* Provides natural easing similar to SmoothStep but using trigonometry
|
|
110
|
+
* Cosine interpolation — smooth curve using the cosine function.
|
|
111
|
+
* Provides natural easing similar to SmoothStep but using trigonometry.
|
|
112
|
+
*
|
|
113
|
+
* @param a - Start value (result when t = 0)
|
|
114
|
+
* @param b - End value (result when t = 1)
|
|
115
|
+
* @param t - Interpolation parameter — unclamped, allowing extrapolation
|
|
116
|
+
* @returns Interpolated value using cosine-based easing curve
|
|
117
|
+
*
|
|
118
|
+
* @example
|
|
119
|
+
* CosineInterpolation(0, 10, 0) // 0
|
|
120
|
+
* CosineInterpolation(0, 10, 1) // 10
|
|
121
|
+
* CosineInterpolation(0, 10, 0.5) // 5 (same as LERP at midpoint; smooth near endpoints)
|
|
51
122
|
*/
|
|
52
123
|
export declare function CosineInterpolation(a: number, b: number, t: number): number;
|
|
53
124
|
/**
|
|
54
|
-
* Sine ease-in interpolation
|
|
55
|
-
* Slow start with smooth acceleration
|
|
125
|
+
* Sine ease-in interpolation.
|
|
126
|
+
* Slow start with smooth sinusoidal acceleration.
|
|
127
|
+
*
|
|
128
|
+
* @param a - Start value (result when t = 0)
|
|
129
|
+
* @param b - End value (result when t = 1)
|
|
130
|
+
* @param t - Interpolation parameter — unclamped, allowing extrapolation
|
|
131
|
+
* @returns Interpolated value with sine-based acceleration from start
|
|
132
|
+
*
|
|
133
|
+
* @example
|
|
134
|
+
* SineEaseIn(0, 10, 0) // 0
|
|
135
|
+
* SineEaseIn(0, 10, 1) // 10
|
|
136
|
+
* SineEaseIn(0, 10, 0.5) // ~2.93 (slower than LinearInterpolation's 5 at midpoint)
|
|
56
137
|
*/
|
|
57
138
|
export declare function SineEaseIn(a: number, b: number, t: number): number;
|
|
58
139
|
/**
|
|
59
|
-
* Sine ease-out interpolation
|
|
60
|
-
*
|
|
140
|
+
* Sine ease-out interpolation.
|
|
141
|
+
* Fast start with smooth sinusoidal deceleration to the end.
|
|
142
|
+
*
|
|
143
|
+
* @param a - Start value (result when t = 0)
|
|
144
|
+
* @param b - End value (result when t = 1)
|
|
145
|
+
* @param t - Interpolation parameter — unclamped, allowing extrapolation
|
|
146
|
+
* @returns Interpolated value with sine-based deceleration toward end
|
|
147
|
+
*
|
|
148
|
+
* @example
|
|
149
|
+
* SineEaseOut(0, 10, 0) // 0
|
|
150
|
+
* SineEaseOut(0, 10, 1) // 10
|
|
151
|
+
* SineEaseOut(0, 10, 0.5) // ~7.07 (faster than LinearInterpolation's 5 at midpoint)
|
|
61
152
|
*/
|
|
62
153
|
export declare function SineEaseOut(a: number, b: number, t: number): number;
|
|
63
154
|
/**
|
|
64
|
-
* Exponential ease-in interpolation
|
|
65
|
-
* Very slow start, then rapid acceleration
|
|
155
|
+
* Exponential ease-in interpolation (2^(10t−10)).
|
|
156
|
+
* Very slow start, then rapid exponential acceleration.
|
|
157
|
+
*
|
|
158
|
+
* @param a - Start value (result when t = 0)
|
|
159
|
+
* @param b - End value (result when t = 1)
|
|
160
|
+
* @param t - Interpolation parameter — unclamped, allowing extrapolation
|
|
161
|
+
* @returns Interpolated value with exponential acceleration from start
|
|
162
|
+
*
|
|
163
|
+
* @example
|
|
164
|
+
* ExponentialEaseIn(0, 10, 0) // 0
|
|
165
|
+
* ExponentialEaseIn(0, 10, 1) // 10
|
|
166
|
+
* ExponentialEaseIn(0, 10, 0.5) // ~0.31 (barely moved at midpoint)
|
|
66
167
|
*/
|
|
67
168
|
export declare function ExponentialEaseIn(a: number, b: number, t: number): number;
|
|
68
169
|
/**
|
|
69
|
-
* Exponential ease-out interpolation
|
|
70
|
-
* Rapid start, then very slow deceleration
|
|
170
|
+
* Exponential ease-out interpolation (1 − 2^(−10t)).
|
|
171
|
+
* Rapid start, then very slow exponential deceleration.
|
|
172
|
+
*
|
|
173
|
+
* @param a - Start value (result when t = 0)
|
|
174
|
+
* @param b - End value (result when t = 1)
|
|
175
|
+
* @param t - Interpolation parameter — unclamped, allowing extrapolation
|
|
176
|
+
* @returns Interpolated value with exponential deceleration toward end
|
|
177
|
+
*
|
|
178
|
+
* @example
|
|
179
|
+
* ExponentialEaseOut(0, 10, 0) // 0
|
|
180
|
+
* ExponentialEaseOut(0, 10, 1) // 10
|
|
181
|
+
* ExponentialEaseOut(0, 10, 0.5) // ~9.69 (nearly done at midpoint)
|
|
71
182
|
*/
|
|
72
183
|
export declare function ExponentialEaseOut(a: number, b: number, t: number): number;
|
|
73
184
|
/**
|
|
74
|
-
* Elastic ease-out
|
|
75
|
-
* Creates an overshoot effect that
|
|
185
|
+
* Elastic ease-out — bouncy spring-like motion.
|
|
186
|
+
* Creates an overshoot effect that oscillates before settling at the endpoint.
|
|
187
|
+
*
|
|
188
|
+
* @param a - Start value (result when t = 0)
|
|
189
|
+
* @param b - End value (result when t = 1)
|
|
190
|
+
* @param t - Interpolation parameter — clamped to [0, 1] at t=0 and t=1 boundaries
|
|
191
|
+
* @returns Interpolated value with elastic overshoot effect toward end
|
|
192
|
+
*
|
|
193
|
+
* @example
|
|
194
|
+
* ElasticEaseOut(0, 10, 0) // 0
|
|
195
|
+
* ElasticEaseOut(0, 10, 1) // 10
|
|
196
|
+
* ElasticEaseOut(0, 10, 0.8) // ~10.86 (overshoots target before settling)
|
|
76
197
|
*/
|
|
77
198
|
export declare function ElasticEaseOut(a: number, b: number, t: number): number;
|
|
78
199
|
/**
|
|
79
|
-
* Back ease-out
|
|
80
|
-
* Creates a slight overshoot before settling
|
|
200
|
+
* Back ease-out — overshoots then settles.
|
|
201
|
+
* Creates a slight overshoot beyond the target before settling into place.
|
|
202
|
+
*
|
|
203
|
+
* @param a - Start value (result when t = 0)
|
|
204
|
+
* @param b - End value (result when t = 1)
|
|
205
|
+
* @param t - Interpolation parameter — unclamped, allowing extrapolation
|
|
206
|
+
* @returns Interpolated value with back overshoot effect toward end
|
|
207
|
+
*
|
|
208
|
+
* @example
|
|
209
|
+
* BackEaseOut(0, 10, 0) // 0
|
|
210
|
+
* BackEaseOut(0, 10, 1) // 10
|
|
211
|
+
* BackEaseOut(0, 10, 0.75) // ~10.88 (overshoots before settling)
|
|
81
212
|
*/
|
|
82
213
|
export declare function BackEaseOut(a: number, b: number, t: number): number;
|
|
83
214
|
/**
|
|
84
|
-
* Bounce ease-out
|
|
85
|
-
*
|
|
215
|
+
* Bounce ease-out — simulates a ball bouncing to rest.
|
|
216
|
+
* Produces a series of bounces with decreasing amplitude before settling at the endpoint.
|
|
217
|
+
*
|
|
218
|
+
* @param a - Start value (result when t = 0)
|
|
219
|
+
* @param b - End value (result when t = 1)
|
|
220
|
+
* @param t - Interpolation parameter — unclamped, allowing extrapolation
|
|
221
|
+
* @returns Interpolated value with bouncing effect toward end
|
|
222
|
+
*
|
|
223
|
+
* @example
|
|
224
|
+
* BounceEaseOut(0, 10, 0) // 0
|
|
225
|
+
* BounceEaseOut(0, 10, 1) // 10
|
|
226
|
+
* BounceEaseOut(0, 10, 0.5) // ~7.65 (mid-bounce)
|
|
86
227
|
*/
|
|
87
228
|
export declare function BounceEaseOut(a: number, b: number, t: number): number;
|
|
88
229
|
/**
|
|
89
|
-
* Catmull-Rom spline interpolation between
|
|
90
|
-
*
|
|
230
|
+
* Catmull-Rom spline interpolation between four control points.
|
|
231
|
+
* Produces a smooth curve that passes through p1 and p2 with tangents influenced by p0 and p3.
|
|
232
|
+
*
|
|
233
|
+
* @param p0 - Previous control point (influences the tangent at p1)
|
|
234
|
+
* @param p1 - Start point (result when t = 0)
|
|
235
|
+
* @param p2 - End point (result when t = 1)
|
|
236
|
+
* @param p3 - Next control point (influences the tangent at p2)
|
|
237
|
+
* @param t - Interpolation parameter (typically [0, 1], supports extrapolation)
|
|
238
|
+
* @returns Smoothly interpolated value along the Catmull-Rom spline
|
|
239
|
+
*
|
|
240
|
+
* @example
|
|
241
|
+
* CatmullRomInterpolation(0, 5, 10, 15, 0) // 5 (at p1)
|
|
242
|
+
* CatmullRomInterpolation(0, 5, 10, 15, 1) // 10 (at p2)
|
|
243
|
+
* CatmullRomInterpolation(0, 5, 10, 15, 0.5) // 7.5
|
|
91
244
|
*/
|
|
92
245
|
export declare function CatmullRomInterpolation(p0: number, p1: number, p2: number, p3: number, t: number): number;
|
|
93
246
|
/**
|
|
94
|
-
* Hermite interpolation with tangent control
|
|
95
|
-
* Provides precise control over curve
|
|
247
|
+
* Hermite spline interpolation with explicit tangent control.
|
|
248
|
+
* Provides precise control over the curve's tangent at both the start and end points.
|
|
249
|
+
*
|
|
250
|
+
* @param p0 - Start point (result when t = 0)
|
|
251
|
+
* @param p1 - End point (result when t = 1)
|
|
252
|
+
* @param t0 - Tangent (velocity) at the start point
|
|
253
|
+
* @param t1 - Tangent (velocity) at the end point
|
|
254
|
+
* @param t - Interpolation parameter (typically [0, 1], supports extrapolation)
|
|
255
|
+
* @returns Interpolated value along the Hermite spline
|
|
256
|
+
*
|
|
257
|
+
* @example
|
|
258
|
+
* HermiteInterpolation(0, 10, 0, 0, 0) // 0 (at start)
|
|
259
|
+
* HermiteInterpolation(0, 10, 0, 0, 1) // 10 (at end)
|
|
260
|
+
* HermiteInterpolation(0, 10, 0, 0, 0.5) // 5 (flat tangents → same as LERP at midpoint)
|
|
96
261
|
*/
|
|
97
262
|
export declare function HermiteInterpolation(p0: number, p1: number, t0: number, t1: number, t: number): number;
|
|
98
263
|
/**
|
|
99
|
-
* Circular ease-in interpolation
|
|
100
|
-
* Creates an accelerating curve based on quarter circle
|
|
264
|
+
* Circular ease-in interpolation (1 − √(1−t²)).
|
|
265
|
+
* Creates an accelerating curve based on the first quarter of a circle.
|
|
266
|
+
*
|
|
267
|
+
* @param a - Start value (result when t = 0)
|
|
268
|
+
* @param b - End value (result when t = 1)
|
|
269
|
+
* @param t - Interpolation parameter — clamped to [0, 1] for a valid circular arc
|
|
270
|
+
* @returns Interpolated value with circular acceleration from start
|
|
271
|
+
*
|
|
272
|
+
* @example
|
|
273
|
+
* CircularEaseIn(0, 10, 0) // 0
|
|
274
|
+
* CircularEaseIn(0, 10, 1) // 10
|
|
275
|
+
* CircularEaseIn(0, 10, 0.5) // ~1.34 (very slow start along circular arc)
|
|
101
276
|
*/
|
|
102
277
|
export declare function CircularEaseIn(a: number, b: number, t: number): number;
|
|
103
278
|
/**
|
|
104
|
-
* Circular ease-out interpolation
|
|
105
|
-
* Creates a decelerating curve based on quarter circle
|
|
279
|
+
* Circular ease-out interpolation (√(1−(t−1)²)).
|
|
280
|
+
* Creates a decelerating curve based on the first quarter of a circle.
|
|
281
|
+
*
|
|
282
|
+
* @param a - Start value (result when t = 0)
|
|
283
|
+
* @param b - End value (result when t = 1)
|
|
284
|
+
* @param t - Interpolation parameter — clamped to [0, 1] for a valid circular arc
|
|
285
|
+
* @returns Interpolated value with circular deceleration toward end
|
|
286
|
+
*
|
|
287
|
+
* @example
|
|
288
|
+
* CircularEaseOut(0, 10, 0) // 0
|
|
289
|
+
* CircularEaseOut(0, 10, 1) // 10
|
|
290
|
+
* CircularEaseOut(0, 10, 0.5) // ~8.66 (very fast start along circular arc)
|
|
106
291
|
*/
|
|
107
292
|
export declare function CircularEaseOut(a: number, b: number, t: number): number;
|
|
108
293
|
/**
|
|
109
|
-
* Quadratic ease-in-out interpolation (2t² for t<0.5, 1−(−2t+2)²/2 for t≥0.5)
|
|
110
|
-
* Symmetrically accelerates at the start and decelerates at the end
|
|
294
|
+
* Quadratic ease-in-out interpolation (2t² for t < 0.5, 1 − (−2t+2)²/2 for t ≥ 0.5).
|
|
295
|
+
* Symmetrically accelerates at the start and decelerates at the end.
|
|
296
|
+
*
|
|
297
|
+
* @param a - Start value (result when t = 0)
|
|
298
|
+
* @param b - End value (result when t = 1)
|
|
299
|
+
* @param t - Interpolation parameter (typically [0, 1])
|
|
300
|
+
* @returns Interpolated value with quadratic symmetric easing
|
|
301
|
+
*
|
|
302
|
+
* @example
|
|
303
|
+
* QuadraticEaseInOut(0, 10, 0) // 0
|
|
304
|
+
* QuadraticEaseInOut(0, 10, 1) // 10
|
|
305
|
+
* QuadraticEaseInOut(0, 10, 0.25) // 1.25 (slow start)
|
|
306
|
+
* QuadraticEaseInOut(0, 10, 0.75) // 8.75 (slow end)
|
|
111
307
|
*/
|
|
112
308
|
export declare function QuadraticEaseInOut(a: number, b: number, t: number): number;
|
|
113
309
|
/**
|
|
114
|
-
* Cubic ease-in-out interpolation (4t³ for t<0.5, 1−(−2t+2)³/2 for t≥0.5)
|
|
115
|
-
* More pronounced symmetrical acceleration/deceleration than quadratic
|
|
310
|
+
* Cubic ease-in-out interpolation (4t³ for t < 0.5, 1 − (−2t+2)³/2 for t ≥ 0.5).
|
|
311
|
+
* More pronounced symmetrical acceleration/deceleration than quadratic ease-in-out.
|
|
312
|
+
*
|
|
313
|
+
* @param a - Start value (result when t = 0)
|
|
314
|
+
* @param b - End value (result when t = 1)
|
|
315
|
+
* @param t - Interpolation parameter (typically [0, 1])
|
|
316
|
+
* @returns Interpolated value with cubic symmetric easing
|
|
317
|
+
*
|
|
318
|
+
* @example
|
|
319
|
+
* CubicEaseInOut(0, 10, 0) // 0
|
|
320
|
+
* CubicEaseInOut(0, 10, 1) // 10
|
|
321
|
+
* CubicEaseInOut(0, 10, 0.25) // 0.625 (very slow start)
|
|
322
|
+
* CubicEaseInOut(0, 10, 0.75) // 9.375 (very slow end)
|
|
116
323
|
*/
|
|
117
324
|
export declare function CubicEaseInOut(a: number, b: number, t: number): number;
|
|
118
325
|
/**
|
|
119
|
-
* Sine ease-in-out interpolation (−(cos(πt)−1)/2)
|
|
120
|
-
* Smooth symmetric easing using cosine — gentle and natural feeling
|
|
326
|
+
* Sine ease-in-out interpolation (−(cos(πt) − 1) / 2).
|
|
327
|
+
* Smooth symmetric easing using cosine — gentle and natural feeling.
|
|
328
|
+
*
|
|
329
|
+
* @param a - Start value (result when t = 0)
|
|
330
|
+
* @param b - End value (result when t = 1)
|
|
331
|
+
* @param t - Interpolation parameter (typically [0, 1])
|
|
332
|
+
* @returns Interpolated value with sine-based symmetric easing
|
|
333
|
+
*
|
|
334
|
+
* @example
|
|
335
|
+
* SineEaseInOut(0, 10, 0) // 0
|
|
336
|
+
* SineEaseInOut(0, 10, 1) // 10
|
|
337
|
+
* SineEaseInOut(0, 10, 0.5) // 5 (symmetric midpoint)
|
|
121
338
|
*/
|
|
122
339
|
export declare function SineEaseInOut(a: number, b: number, t: number): number;
|
|
123
340
|
/**
|
|
124
|
-
* Exponential ease-in-out interpolation
|
|
125
|
-
* Very slow at both ends
|
|
341
|
+
* Exponential ease-in-out interpolation.
|
|
342
|
+
* Very slow at both ends with an extremely rapid transition in the middle.
|
|
343
|
+
*
|
|
344
|
+
* @param a - Start value (result when t = 0)
|
|
345
|
+
* @param b - End value (result when t = 1)
|
|
346
|
+
* @param t - Interpolation parameter (typically [0, 1])
|
|
347
|
+
* @returns Interpolated value with exponential symmetric easing
|
|
348
|
+
*
|
|
349
|
+
* @example
|
|
350
|
+
* ExponentialEaseInOut(0, 10, 0) // 0
|
|
351
|
+
* ExponentialEaseInOut(0, 10, 1) // 10
|
|
352
|
+
* ExponentialEaseInOut(0, 10, 0.25) // ~0.16 (barely moving in the first quarter)
|
|
126
353
|
*/
|
|
127
354
|
export declare function ExponentialEaseInOut(a: number, b: number, t: number): number;
|
|
128
355
|
/**
|
|
129
|
-
* Circular ease-in-out interpolation
|
|
130
|
-
* Smooth symmetric arc-based easing
|
|
356
|
+
* Circular ease-in-out interpolation.
|
|
357
|
+
* Smooth symmetric arc-based easing using a circular curve.
|
|
358
|
+
*
|
|
359
|
+
* @param a - Start value (result when t = 0)
|
|
360
|
+
* @param b - End value (result when t = 1)
|
|
361
|
+
* @param t - Interpolation parameter (typically [0, 1])
|
|
362
|
+
* @returns Interpolated value with circular symmetric easing
|
|
363
|
+
*
|
|
364
|
+
* @example
|
|
365
|
+
* CircularEaseInOut(0, 10, 0) // 0
|
|
366
|
+
* CircularEaseInOut(0, 10, 1) // 10
|
|
367
|
+
* CircularEaseInOut(0, 10, 0.25) // ~0.67 (very slow circular start)
|
|
131
368
|
*/
|
|
132
369
|
export declare function CircularEaseInOut(a: number, b: number, t: number): number;
|
|
133
370
|
/**
|
|
134
|
-
* Elastic ease-in interpolation
|
|
135
|
-
* Spring-like acceleration from rest — starts with a
|
|
371
|
+
* Elastic ease-in interpolation.
|
|
372
|
+
* Spring-like acceleration from rest — starts with a backward oscillation then launches forward.
|
|
373
|
+
*
|
|
374
|
+
* @param a - Start value (result when t = 0)
|
|
375
|
+
* @param b - End value (result when t = 1)
|
|
376
|
+
* @param t - Interpolation parameter — clamped to [0, 1] at t=0 and t=1 boundaries
|
|
377
|
+
* @returns Interpolated value with elastic spring acceleration from start
|
|
378
|
+
*
|
|
379
|
+
* @example
|
|
380
|
+
* ElasticEaseIn(0, 10, 0) // 0
|
|
381
|
+
* ElasticEaseIn(0, 10, 1) // 10
|
|
382
|
+
* ElasticEaseIn(0, 10, 0.5) // ~-0.16 (backward oscillation at midpoint before launching)
|
|
136
383
|
*/
|
|
137
384
|
export declare function ElasticEaseIn(a: number, b: number, t: number): number;
|
|
138
385
|
/**
|
|
139
|
-
* Elastic ease-in-out interpolation
|
|
140
|
-
* Spring-like oscillation at both the start and end
|
|
386
|
+
* Elastic ease-in-out interpolation.
|
|
387
|
+
* Spring-like oscillation at both the start and end of the motion.
|
|
388
|
+
*
|
|
389
|
+
* @param a - Start value (result when t = 0)
|
|
390
|
+
* @param b - End value (result when t = 1)
|
|
391
|
+
* @param t - Interpolation parameter — clamped to [0, 1] at t=0 and t=1 boundaries
|
|
392
|
+
* @returns Interpolated value with elastic oscillation at both ends
|
|
393
|
+
*
|
|
394
|
+
* @example
|
|
395
|
+
* ElasticEaseInOut(0, 10, 0) // 0
|
|
396
|
+
* ElasticEaseInOut(0, 10, 1) // 10
|
|
397
|
+
* ElasticEaseInOut(0, 10, 0.4) // ~-1.17 (backward oscillation before midpoint)
|
|
141
398
|
*/
|
|
142
399
|
export declare function ElasticEaseInOut(a: number, b: number, t: number): number;
|
|
143
400
|
/**
|
|
144
|
-
* Back ease-in interpolation (c3t³ − c1t²)
|
|
145
|
-
* Slight backward pull before launching forward
|
|
401
|
+
* Back ease-in interpolation (c3t³ − c1t²).
|
|
402
|
+
* Slight backward pull before launching forward — like winding up before a throw.
|
|
403
|
+
*
|
|
404
|
+
* @param a - Start value (result when t = 0)
|
|
405
|
+
* @param b - End value (result when t = 1)
|
|
406
|
+
* @param t - Interpolation parameter — unclamped, allowing extrapolation
|
|
407
|
+
* @returns Interpolated value with back overshoot at start
|
|
408
|
+
*
|
|
409
|
+
* @example
|
|
410
|
+
* BackEaseIn(0, 10, 0) // 0
|
|
411
|
+
* BackEaseIn(0, 10, 1) // 10
|
|
412
|
+
* BackEaseIn(0, 10, 0.25) // ~-0.64 (dips below start before accelerating forward)
|
|
146
413
|
*/
|
|
147
414
|
export declare function BackEaseIn(a: number, b: number, t: number): number;
|
|
148
415
|
/**
|
|
149
|
-
* Back ease-in-out interpolation
|
|
150
|
-
* Slight backward pull at both ends before and after the main motion
|
|
416
|
+
* Back ease-in-out interpolation.
|
|
417
|
+
* Slight backward pull at both ends before and after the main forward motion.
|
|
418
|
+
*
|
|
419
|
+
* @param a - Start value (result when t = 0)
|
|
420
|
+
* @param b - End value (result when t = 1)
|
|
421
|
+
* @param t - Interpolation parameter — unclamped, allowing extrapolation
|
|
422
|
+
* @returns Interpolated value with back overshoot at both start and end
|
|
423
|
+
*
|
|
424
|
+
* @example
|
|
425
|
+
* BackEaseInOut(0, 10, 0) // 0
|
|
426
|
+
* BackEaseInOut(0, 10, 1) // 10
|
|
427
|
+
* BackEaseInOut(0, 10, 0.25) // ~-1.00 (dips backward at start)
|
|
151
428
|
*/
|
|
152
429
|
export declare function BackEaseInOut(a: number, b: number, t: number): number;
|
|
153
430
|
/**
|
|
154
|
-
* Bounce ease-in interpolation
|
|
155
|
-
* Bouncing ball effect
|
|
431
|
+
* Bounce ease-in interpolation.
|
|
432
|
+
* Bouncing ball effect at the start — multiple bounces before launching toward the target.
|
|
433
|
+
*
|
|
434
|
+
* @param a - Start value (result when t = 0)
|
|
435
|
+
* @param b - End value (result when t = 1)
|
|
436
|
+
* @param t - Interpolation parameter — unclamped, allowing extrapolation
|
|
437
|
+
* @returns Interpolated value with bounce effect at start
|
|
438
|
+
*
|
|
439
|
+
* @example
|
|
440
|
+
* BounceEaseIn(0, 10, 0) // 0
|
|
441
|
+
* BounceEaseIn(0, 10, 1) // 10
|
|
442
|
+
* BounceEaseIn(0, 10, 0.5) // ~2.34 (still bouncing at midpoint)
|
|
156
443
|
*/
|
|
157
444
|
export declare function BounceEaseIn(a: number, b: number, t: number): number;
|
|
158
445
|
/**
|
|
159
|
-
* Bounce ease-in-out interpolation
|
|
160
|
-
* Bouncing ball effect at both the start and the
|
|
446
|
+
* Bounce ease-in-out interpolation.
|
|
447
|
+
* Bouncing ball effect at both the start and end of the motion.
|
|
448
|
+
*
|
|
449
|
+
* @param a - Start value (result when t = 0)
|
|
450
|
+
* @param b - End value (result when t = 1)
|
|
451
|
+
* @param t - Interpolation parameter — unclamped, allowing extrapolation
|
|
452
|
+
* @returns Interpolated value with bounce effect at both start and end
|
|
453
|
+
*
|
|
454
|
+
* @example
|
|
455
|
+
* BounceEaseInOut(0, 10, 0) // 0
|
|
456
|
+
* BounceEaseInOut(0, 10, 1) // 10
|
|
457
|
+
* BounceEaseInOut(0, 10, 0.25) // ~1.17 (bouncing at start quarter)
|
|
161
458
|
*/
|
|
162
459
|
export declare function BounceEaseInOut(a: number, b: number, t: number): number;
|
|
163
460
|
/**
|
|
164
|
-
* Step interpolation
|
|
165
|
-
*
|
|
461
|
+
* Step interpolation — instant transition at a configurable threshold.
|
|
462
|
+
* Returns `a` when `t` is below the threshold, and `b` at or above it.
|
|
463
|
+
* Useful for discrete state changes and on/off animations.
|
|
464
|
+
*
|
|
465
|
+
* @param a - Start value (returned when t < threshold)
|
|
466
|
+
* @param b - End value (returned when t ≥ threshold)
|
|
467
|
+
* @param t - Interpolation parameter (clamped to [0, 1])
|
|
468
|
+
* @param threshold - Normalized transition point (default: 0.5; clamped to [0, 1])
|
|
469
|
+
* @returns Either `a` or `b` depending on `t` relative to `threshold`
|
|
470
|
+
*
|
|
471
|
+
* @example
|
|
472
|
+
* StepInterpolation(0, 10, 0.3) // 0 (below default threshold of 0.5)
|
|
473
|
+
* StepInterpolation(0, 10, 0.7) // 10 (at or above default threshold of 0.5)
|
|
474
|
+
* StepInterpolation(0, 10, 0.3, 0.25) // 10 (above custom threshold of 0.25)
|
|
166
475
|
*/
|
|
167
476
|
export declare function StepInterpolation(a: number, b: number, t: number, threshold?: number): number;
|
|
168
477
|
/**
|
|
169
|
-
* Spherical linear interpolation for scalar values
|
|
170
|
-
*
|
|
171
|
-
*
|
|
478
|
+
* Spherical linear interpolation for scalar values.
|
|
479
|
+
* For scalar inputs, this is mathematically equivalent to {@link LinearInterpolation}.
|
|
480
|
+
* For true spherical rotation interpolation, use `QuaternionSLERP` from the quaternions module.
|
|
481
|
+
*
|
|
482
|
+
* @param a - Start value (result when t = 0)
|
|
483
|
+
* @param b - End value (result when t = 1)
|
|
484
|
+
* @param t - Interpolation parameter — unclamped, allowing extrapolation
|
|
485
|
+
* @returns Linearly interpolated value (identical to `LinearInterpolation(a, b, t)`)
|
|
486
|
+
*
|
|
172
487
|
* @deprecated This function is identical to LinearInterpolation and is not a true spherical interpolation. For quaternion spherical interpolation, use QuaternionSLERP from the quaternions module.
|
|
173
488
|
*/
|
|
174
489
|
export declare function SphericalLinearInterpolation(a: number, b: number, t: number): number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interpolation.d.ts","sourceRoot":"","sources":["../src/interpolation.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"interpolation.d.ts","sourceRoot":"","sources":["../src/interpolation.ts"],"names":[],"mappings":"AAiCA;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAG3E;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAKlE;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAKpE;AAED;;;;;;;;;;;;;GAaG;AACH,wBA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