UNPKG

@tempots/dom

Version:

Fully-typed frontend framework alternative to React and Angular

57 lines (56 loc) 1.83 kB
/** * Represents a function that interpolates between two values. * * @typeParam T - The type of the values being interpolated. * @param start - The starting value. * @param end - The ending value. * @param delta - The interpolation factor between 0 and 1. * @returns The interpolated value. * @public */ export type Interpolate<T> = (start: T, end: T, delta: number) => T; /** * Interpolates a number between a start and end value based on a delta. * * @param start - The starting value. * @param end - The ending value. * @param delta - The delta value between 0 and 1. * @returns The interpolated number. * @public */ export declare const interpolateNumber: Interpolate<number>; /** * Interpolates between two strings based on a delta value. * * @param start - The starting string. * @param end - The ending string. * @param delta - The delta value between 0 and 1. * @returns The interpolated string. * @public */ export declare const interpolateString: Interpolate<string>; /** * Interpolates between two dates based on a delta value. * * @param start - The starting date. * @param end - The ending date. * @param delta - The delta value between 0 and 1. * @returns The interpolated date. * @public */ export declare const interpolateDate: Interpolate<Date>; /** * A fake interpolate function that always returns the end value. * * @public */ export declare const endInterpolate: <T>(_start: T, end: T) => T; /** * Returns an interpolation function based on the type of the value. * * @typeParam T - The type of the value. * @param value - The value to be interpolated. * @returns An interpolation function that takes a start value, an end value, and a delta, and returns an interpolated value. * @public */ export declare const guessInterpolate: <T>(value: T) => Interpolate<T>;