UNPKG

@thi.ng/ramp

Version:

Extensible keyframe interpolation/tweening of arbitrary, nested types

45 lines 1.69 kB
import type { FnN } from "@thi.ng/api"; import type { Vec } from "@thi.ng/vectors"; import type { Frame, RampImpl, RampOpts, VecAPI } from "./api.js"; import { Ramp } from "./ramp.js"; /** * Syntax sugar for creating a numeric {@link Ramp} using the {@link EASING_N} * ramp interpolation impl (supporting arbitrary easing functions), given * `stops` (aka keyframes, minimum 2 required) and options. * * @remarks * Easing functions remap time values in the `[0,1]` range. By default uses * [`easeInOut5`](https://docs.thi.ng/umbrella/math/functions/easeInOut5.html). * * For vector-valued ramps, use {@link ramp} with {@link EASING_V}. * * @param stops * @param opts */ export declare const easing: (stops: Frame<number>[], opts?: Partial<RampOpts & { easing: FnN; }>) => Ramp<number>; /** * Higher-order ramp interpolation implementation supporting arbitrary `easing` * function to control keyframe interpolation. * * @remarks * Easing functions remap time values in the `[0,1]` range. By default uses * [`easeInOut5`](https://docs.thi.ng/umbrella/math/functions/easeInOut5.html). * * @param easing */ export declare const EASING_N: (easing?: FnN) => RampImpl<number>; /** * Vector version of {@link EASING_N}. Use with any of the supplied vector APIs: * {@link VEC} (arbitrary size), {@link VEC2}, {@link VEC3} or {@link VEC4}. * * @remarks * Easing functions remap time values in the `[0,1]` range. By default uses * [`easeInOut5`](https://docs.thi.ng/umbrella/math/functions/easeInOut5.html). * * @param vec * @param easing */ export declare const EASING_V: <T extends Vec>(vec: VecAPI, easing?: FnN) => RampImpl<T>; //# sourceMappingURL=easing.d.ts.map