import { Expr, GpuFragmentParams } from '../../gpu/contract'; import { d } from '../../gpu/kit/index'; import { PropRef } from '../values'; import { ArgSpec } from '../invoke'; /** What a generator's `paint:` field takes: a function that returns the color at this pixel. */ export type Paint = (params: GpuFragmentParams) => Expr; /** * A flat fill in one color prop. * * The color's alpha passes through, so a half-transparent color gives a half-transparent layer. * * @example * ```ts * paint: solidColor(p('color')) * ``` */ export declare function solidColor(color: PropRef): Paint; /** * A striped gradient that slides across the canvas, cycling through its colors over time. * * `mode` is a `compileTime` prop: `'rainbow'` generates a full spectrum, `'custom'` loops * `palette.a` to `b` to `c` and back, mixed in the color space named by the `space` prop * (also `compileTime`, ignored in rainbow mode). `direction` in degrees turns the stripes * about the canvas center, `scale` sets how many color cycles cross the canvas (1 is a * single wide sweep). It moves on the layer's clock, so declare `animatedTime: {speed: 'speed'}`. * * @example * ```ts * paint: colorWheel({mode: p('mode'), direction: p('angle'), scale: p('scale'), palette: {a: p('colorA'), b: p('colorB'), c: p('colorC')}, space: p('colorSpace')}) * ``` * @see pointCloudGradient */ export declare function colorWheel(slots: { mode: PropRef; direction: ArgSpec; scale: ArgSpec; palette: { a: PropRef; b: PropRef; c: PropRef; }; space: PropRef; }): Paint; /** * Five colored points placed anywhere on the canvas, each pixel taking the colors of the points nearest it. * * Pass exactly five `{color, position}` prop pairs (positions made with `transformPosition`). * `smoothness` (0–5) widens each point's reach as it rises. The mix happens in the color * space named by the `space` prop (mark it `compileTime`). * * @example * ```ts * paint: pointCloudGradient({points: [{color: p('colorA'), position: p('positionA')}, {color: p('colorB'), position: p('positionB')}, {color: p('colorC'), position: p('positionC')}, {color: p('colorD'), position: p('positionD')}, {color: p('colorE'), position: p('positionE')}], smoothness: p('smoothness'), space: p('colorSpace')}) * ``` * @tip For a softer, animated version with any number of points, see `scatterField` in the fields words. * @see colorWheel */ export declare function pointCloudGradient(slots: { points: { color: PropRef; position: PropRef; }[]; smoothness: ArgSpec; space: PropRef; }): Paint; /** * The `extraFields` a `beam` definition must declare. * * Spread it as `extraFields: beamPreconvertedFields` next to the `beam` paint. * * @example * ```ts * extraFields: beamPreconvertedFields, * ``` * @see beam */ export declare const beamPreconvertedFields: { /** @internal */ convA: { schema: d.Vec3f; initial: number[]; }; /** @internal */ convB: { schema: d.Vec3f; initial: number[]; }; }; /** * A glowing beam of light between two points. * * `from` and `to` are position props (made with `transformPosition`). `thickness` (0–2) and * `softness` each take a `start` and `end` value so the beam can taper. The cross-section * shades from `colors.inside` at the core to `colors.outside` at the edge, mixed in the color * space named by the `space` prop (mark it `compileTime`). Declare * `extraFields: beamPreconvertedFields` on the definition. * * @example * ```ts * paint: beam({from: p('startPosition'), to: p('endPosition'), thickness: {start: p('startThickness'), end: p('endThickness')}, softness: {start: p('startSoftness'), end: p('endSoftness')}, colors: {inside: p('insideColor'), outside: p('outsideColor')}, space: p('colorSpace')}) * ``` * @see beamPreconvertedFields */ export declare function beam(slots: { from: PropRef; to: PropRef; thickness: { start: ArgSpec; end: ArgSpec; }; softness: { start: ArgSpec; end: ArgSpec; }; colors: { inside: PropRef; outside: PropRef; }; space: PropRef; }): Paint; //# sourceMappingURL=gradients.d.ts.map