UNPKG

@thi.ng/ramp

Version:

Extensible keyframe interpolation/tweening of arbitrary, nested types

41 lines 1.5 kB
import type { ICopy, IEmpty } from "@thi.ng/api"; import type { Frame, IRamp, RampBounds, RampDomain, RampImpl, RampOpts } from "./api.js"; /** * Syntax sugar for {@link Ramp} constructor using the given ramp interpolation * `impl`, keyframes `stops` (minimum 2) and options. * * @param impl * @param stops * @param opts */ export declare const ramp: <T>(impl: RampImpl<T>, stops: Frame<T>[], opts?: Partial<RampOpts>) => Ramp<T>; export declare class Ramp<T> implements ICopy<IRamp<T>>, IEmpty<IRamp<T>>, IRamp<T> { impl: RampImpl<T>; stops: Frame<T>[]; domain: RampDomain; constructor(impl: RampImpl<T>, stops: Frame<T>[], opts?: Partial<RampOpts>); copy(): Ramp<T>; empty(): Ramp<T>; /** * Samples the ramp at given time `t` and returns interpolated value. * * @remarks * The given `t` is first processed by the configured time * {@link Ramp.domain} function. * * @param t */ at(t: number): T; samples(n?: number, start?: number, end?: number): Iterable<Frame<T>>; bounds(): RampBounds<T>; timeBounds(): [number, number]; setStopAt(t: number, val: 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; sort(): void; uniform(): void; protected timeIndex(t: number): number; } //# sourceMappingURL=ramp.d.ts.map