UNPKG

@thi.ng/shader-ast-stdlib

Version:

Function collection for modular GPGPU / shader programming with @thi.ng/shader-ast

29 lines 930 B
import { type FloatTerm, type Vec3Term } from "@thi.ng/shader-ast"; /** * Inline function. Computes the unclamped cosine-based color gradient value: * `a+b*cos(2π*(c*t+d))`, where `a`..`d` are the gradient coefficients and `t` * the gradient position in the `[0,1]` interval. * * @remarks * Based on technique by Inigo Quilez * * References: * * - https://iquilezles.org/articles/palettes/ * - https://github.com/thi-ng/umbrella/tree/develop/packages/color#cosine-gradients * * @example * ```ts * import { cosineGradient, COSINE_GRADIENTS } from "@thi.ng/shader-ast-stdlib"; * * const rgb = cosineGradient(...COSINE_GRADIENTS["rainbow1"], 0.8) * ``` * * @param a * @param b * @param c * @param d * @param t */ export declare const cosineGradient: (a: Vec3Term, b: Vec3Term, c: Vec3Term, d: Vec3Term, t: FloatTerm) => import("@thi.ng/shader-ast").Op2<"vec3">; //# sourceMappingURL=cosine-gradient.d.ts.map