import type { Fn, Fn2 } from "@thi.ng/api"; import type { Vec, VecOpN, VecOpVV, VecOpVVN } from "@thi.ng/vectors"; export type Frame = [number, T]; export interface RampImpl { min: Fn2; max: Fn2; at: (stops: Frame[], index: number, t: number) => T; } export interface IReadonlyRamp { /** * Computes interpolated value at time `t`. Depending on implementation, `t` * might first be processed using the ramp's time domain function. * * @remarks * Also see {@link RampOpts.domain}. * * @param t */ at(t: number): T; /** * Returns an iterator of `n` uniformly spaced samples of the time domain * between the first and last keyframe. Each returned sample is a tuple of * `[time, interpolatedValue]`. * * @param n * @param start * @param end */ samples(n?: number, start?: number, end?: number): Iterable>; /** * Computes the ramp's min/max time domain and value bounds. * * @remarks * Also see {@link IReadonlyRamp.timeBounds}. */ bounds(): RampBounds; /** * Computes the ramp's min/max time bounds (i.e. the positions of the first * & last keyframes/stops). * * @remarks * Also see {@link IReadonlyRamp.bounds}. */ timeBounds(): [number, number]; } export interface IRamp extends IReadonlyRamp { impl: RampImpl; stops: Frame[]; setStopAt(t: number, y: T, eps?: number): boolean; removeStopAt(t: number, eps?: number): boolean; removeStopAtIndex(i: number): boolean; closestIndex(t: number, eps?: number): number; clampedIndexTime(i: number, t: number, eps?: number): number; } export interface RampOpts { /** * Time domain mapping function, e.g. to achieve looping. See {@link clamp}, * {@link wrap}, {@link wrapInterval}. * * @remarks * The domain function can be changed dynamically by setting the * {@link Ramp.domain} property. * * @defaultValue {@link unconstrained} */ domain: RampDomain; } export interface RampBounds { min: T; max: T; minT: number; maxT: number; } export type RampDomain = (t: number, min: number, max: number) => number; /** * Operations required for vector interpolations. */ export interface VecAPI { min: VecOpVV; max: VecOpVV; mixN: VecOpVVN; setN: VecOpN; vecOf: Fn; } //# sourceMappingURL=api.d.ts.map