import { GpuFragmentParams, Expr } from '../../gpu/contract'; import { d } from '../../gpu/kit/index'; import { ArgSpec } from '../invoke'; import { PropRef } from '../values'; import { SampleStage } from './blurs'; /** @internal The per-channel sample coordinate behind `chromaticFan`. */ export declare const chromaticOffsetUV: import('typegpu').TgpuFn<(uv: d.Vec2f, angle: d.F32, strength: d.F32, aspect: d.F32, channelOffset: d.F32) => d.Vec2f>; /** * Split the child into red, green and blue copies pushed apart along one direction. * * `angle` is in degrees (0 pushes along x); give the prop `transform: transformAngle`. * `strength` is 0–1, where 1 moves a channel by a tenth of the canvas height. `red`, `green` * and `blue` multiply that shift per channel, usually −1, 0 and 1. Returns a sampling stage; * wrap it in `gatherStack` to make the effect. * * @example * ```ts * effect: gatherStack(chromaticFan({strength: p('strength'), angle: p('angle'), red: p('redOffset'), green: p('greenOffset'), blue: p('blueOffset')}), []) * ``` * @tip Alpha comes from the green copy, so keep `green` at 0 to hold the layer's outline in place. * @see gatherStack, spectralLens */ export declare function chromaticFan(opts: { strength: ArgSpec; angle: ArgSpec; red: ArgSpec; green: ArgSpec; blue: ArgSpec; }): SampleStage; /** The props `spectralLens` reads. Every field is a prop ref (`p('name')`); ranges are the useful slider ranges. */ export interface SpectralLensSlots { /** Position prop (`transform: transformPosition`) the split, focus, warp and swirl pivot around. */ center: PropRef; /** 0–1, how far apart the color copies are pushed; 0 is off. */ spread: PropRef; /** −1 to 1, slides the copies toward one end of the spread; 0 spaces them evenly. */ bias: PropRef; /** Direction of the spread in degrees (`transform: transformAngle`). */ angle: PropRef; /** 0–1, bends the spread from a straight line (0) to a burst out from the center (1). */ perspective: PropRef; /** Number of color copies, 2–50; more is smoother and costlier. */ count: PropRef; /** 0–1, how strongly each copy takes its own color from the spectrum; 0 keeps the original color. */ dispersion: PropRef; /** −1 to 1, where the dispersion lands: −1 only near the center, 1 only toward the edges. */ dispersionShift: PropRef; /** 0–1, turns the dispersion colors around the hue wheel; 1 is a full turn. */ dispersionColor: PropRef; /** 0–1, fades the split out in a round zone at the center. */ focusCenter: PropRef; /** 0–1, fades the split out toward the edges; 1 restores the original image there. */ focusEdges: PropRef; /** −1 to 1, rotates the copies around the center by an angle that grows along the spread. */ swirl: PropRef; /** 0–1, scatters the spread direction with noise; 0 is off. */ noise: PropRef; /** 0–1, how fine the direction noise is. */ noiseFrequency: PropRef; /** 0–1, shifts the noise pattern (a seed). */ noiseOffset: PropRef; /** −1 to 1, fisheye bulge (positive) or pincushion pinch (negative). */ lensBulge: PropRef; /** 0–1, squeezes the image toward a circular outline. */ lensCircle: PropRef; /** 0–1, breaks up the copy edges with grain. */ grainMixer: PropRef; /** 0–1, black-and-white grain laid over the result. */ grainOverlay: PropRef; } /** * Fan the child out into many color-shifted copies through a warped lens, the spectral-lens look. * * A whole fragment for a `gpu:` definition; the child is read as a texture. `count` copies * spread along `angle` around `center`, `dispersion` colors them across the spectrum, the * focus slots fade the split near the center and the edges, `lensBulge` and `lensCircle` * warp the whole image, and `swirl`, `noise` and the grain slots scatter it. Every slot is a * prop ref; the field list on `SpectralLensSlots` gives units and ranges. * * @example * ```ts * gpu: {fragment: spectralLens({center: p('center'), spread: p('spread'), bias: p('bias'), angle: p('angle'), perspective: p('perspective'), count: p('count'), dispersion: p('dispersion'), dispersionShift: p('dispersionShift'), dispersionColor: p('dispersionColor'), focusCenter: p('focusCenter'), focusEdges: p('focusEdges'), swirl: p('swirl'), noise: p('noise'), noiseFrequency: p('noiseFrequency'), noiseOffset: p('noiseOffset'), lensBulge: p('lensBulge'), lensCircle: p('lensCircle'), grainMixer: p('grainMixer'), grainOverlay: p('grainOverlay')})} * ``` * @tip Every pixel samples the child `count` times, and phones cap `count` at 24. Keep it low on large canvases. * @see chromaticFan */ export declare function spectralLens(slots: SpectralLensSlots): (params: GpuFragmentParams) => Expr; //# sourceMappingURL=lens.d.ts.map