@@ -152,39 +152,106 @@ export declare const SpringOutInFrame: TypeFrameFunction;
152
152
* 0 as our start number and 100 as our end number, so, basic interpolation would interpolate between 0 to 100.
153
153
154
154
* If we use a `t` of 0.5, the interpolated value between 0 to 100, is 50.
155
- * {@link interpolateNumber } takes it further, by allowing you to interpolate with more than 2 values,
155
+ * {@link instantNumber } takes it further, by allowing you to interpolate with more than 2 values,
156
156
* it allows for multiple values.
157
157
* E.g. Given an Array of values [0, 100, 0], and a `t` of 0.5, the interpolated value would become 100.
158
158
159
159
* Based on d3.interpolateBasis [https://github.com/d3/d3-interpolate#interpolateBasis],
160
160
* check out the link above for more detail.
161
161
*
162
+ * @param t A number between 0 to 1
163
+ * @param values Array of numbers to interpolate between
164
+ * @param decimal How many decimals should the interpolated value have
165
+ * @return Interpolated number at instant `t`
166
+ *
167
+ * @source Source code of `instantNumber`
168
+ */
169
+ export declare function instantNumber ( t : number , values : number [ ] , decimal ?: number ) : number ;
170
+ /**
171
+ * Buliding on-top of {@link instantNumber}, `interpolateNumber` interpolates between numbers, but unlike {@link instantNumber}
172
+ * `interpolateNumber` uses an Array of `t` instances to generate an array of interpolated values
173
+ *
174
+ * @param arr_t Array of numbers (between 0 to 1) which each represent an instant of the interpolation
175
+ * @param values Array of numbers to interpolate between
176
+ * @param decimal How many decimals should the interpolated value have
177
+ * @return Array of interpolated numbers at different instances
178
+ *
162
179
* @source Source code of `interpolateNumber`
163
180
*/
164
- export declare function interpolateNumber ( frames : number [ ] , values : number [ ] , decimal ?: number ) : number [ ] ;
181
+ export declare function interpolateNumber ( arr_t : number [ ] , values : number [ ] , decimal ?: number ) : number [ ] ;
165
182
/**
166
- * Given an Array of values, find a value using `t` (`t` goes from 0 to 1), by
183
+ * Given an Array of values, find a value using `t` (which goes from 0 to 1), by
167
184
* using `t` to estimate the index of said value in the array of `values`
168
185
169
- * This is meant for interploating strings that aren't number-like
186
+ * This is meant for interplolating strings that aren't number-like
187
+
188
+ * @param t A number between 0 to 1
189
+ * @param values Array of numbers to interpolate between
190
+ * @return Interpolated numbers at different instances
170
191
171
- * @source Source code of `interpolateUsingIndex`
192
+ * @source Source code of `instantSequence`
193
+ */
194
+ export declare function instantSequence < T > ( t : number , values : T [ ] ) : T ;
195
+ /**
196
+ * Given an Array of items, find an item using `t` (which goes from 0 to 1), by
197
+ * using `t` to estimate the index of said value in the array of `values`,
198
+ * then expand that to encompass multiple `t`'s in an Array,
199
+ * which returns Array items which each follow the interpolated index value
200
+
201
+ * This is meant for interplolating strings that aren't number-like
202
+
203
+ * @param arr_t Array of numbers (between 0 to 1) which each represent an instant of the interpolation
204
+ * @param values Array of items to choose from
205
+ * @return Array of Interpolated input Array items at different instances
206
+
207
+ * @source Source code of `interpolateSequence`
208
+ */
209
+ export declare function interpolateSequence < T > ( arr_t : number [ ] , values : T [ ] ) : T [ ] ;
210
+ /**
211
+ * Alias of {@link instantSequence}
212
+ * @deprecated please use {@link instantSequence}, it's the same functionality but different name
213
+ */
214
+ export declare const instantUsingIndex : typeof instantSequence ;
215
+ /**
216
+ * Alias of {@link interpolateSequence}
217
+ * @deprecated please use {@link interpolateSequence}, it's the same functionality but different name
218
+ */
219
+ export declare const interpolateUsingIndex : typeof interpolateSequence ;
220
+ /**
221
+ * Functions the same way {@link instantNumber} works.
222
+ * Convert strings to numbers, and then interpolates the numbers,
223
+ * at the end if there are units on the first value in the `values` array,
224
+ * it will use that unit for the interpolated result.
225
+ * Make sure to read {@link instantNumber}.
226
+ *
227
+ * @source Source code of `instantString`
172
228
*/
173
- export declare function interpolateUsingIndex ( frames : number [ ] , values : ( string | number ) [ ] ) : ( string | number ) [ ] ;
229
+ export declare function instantString ( t : number , values : ( string | number ) [ ] , decimal ?: number ) : string ;
174
230
/**
175
231
* Functions the same way {@link interpolateNumber} works.
176
232
* Convert strings to numbers, and then interpolates the numbers,
177
233
* at the end if there are units on the first value in the `values` array,
178
234
* it will use that unit for the interpolated result.
179
235
* Make sure to read {@link interpolateNumber}.
236
+ *
237
+ * @source Source code of `interpolateString`
238
+ */
239
+ export declare function interpolateString ( arr_t : number [ ] , values : ( string | number ) [ ] , decimal ?: number ) : string [ ] ;
240
+ /**
241
+ * Interpolates all types of values including number, and string values.
242
+ * Make sure to read {@link instantNumber}, {@link instantString} and {@link instantSequence}.
243
+ *
244
+ * @source Source code of `instantComplex`
180
245
*/
181
- export declare function interpolateString ( frames : number [ ] , values : ( string | number ) [ ] , decimal ?: number ) : string [ ] ;
246
+ export declare function instantComplex < T > ( t : number , values : T [ ] , decimal ?: number ) : string | number | T ;
182
247
/**
183
- * Interpolates all types of values including number, string, color, and complex values.
184
- * Complex values are values like "10px solid red", that border, and other CSS Properties use.
185
- * Make sure to read {@link interpolateNumber}, and {@link interpolateString}.
248
+ * Interpolates all types of values including number, string, etc... values.
249
+ * Make sure to read {@link interpolateNumber}, {@link interpolateString} and {@link interpolateSequence},
250
+ * as depending on the values given
251
+ *
252
+ * @source Source code of `interpolateComplex`
186
253
*/
187
- export declare function interpolateComplex ( frames : number [ ] , values : ( string | number ) [ ] , decimal ?: number ) : ( string | number ) [ ] ;
254
+ export declare function interpolateComplex < T > ( arr_t : number [ ] , values : T [ ] , decimal ?: number ) : number [ ] | string [ ] | T [ ] ;
188
255
/**
189
256
* The array frame function format for easings,
190
257
* @example
@@ -375,5 +442,5 @@ export declare function GenerateSpringFrames(options?: TypeEasingOptions): [numb
375
442
* ]
376
443
* ```
377
444
*/
378
- export declare function SpringEasing ( values : ( string | number ) [ ] , options ?: TypeEasingOptions | TypeEasingOptions [ "easing" ] , customInterpolate ?: TypeInterpolationFunction ) : [ ( string | number | any ) [ ] , number ] ;
445
+ export declare function SpringEasing < T > ( values : T [ ] , options ?: TypeEasingOptions | TypeEasingOptions [ "easing" ] , customInterpolate ?: TypeInterpolationFunction ) : readonly [ any [ ] , number ] ;
379
446
export default SpringEasing ;
0 commit comments