gradientMap
Recolor the child by its brightness through a gradient, the Photoshop gradient map.
gradientMap(slots: {
palette: PropRef
colorLow: PropRef
colorMid: PropRef
colorHigh: PropRef
speed: PropRef
contrast: ArgSpec
blackPoint: ArgSpec
whitePoint: ArgSpec
strength: PropRef
colorSpace: PropRef
}): PointwiseEffect
Import effects from shaders/std and use effects.color.gradientMap.
palette is a select prop declared compileTime: true: one of the built-in gradients 'rainbow' | 'sunset' | 'ocean' | 'fire' | 'pastel' | 'neon', or 'custom' to use colorLow, colorMid and colorHigh (shadows, midtones, highlights) mixed in colorSpace. blackPoint and whitePoint (0–1) clip the input brightness. contrast (0–3) steepens the mapping. speed scrolls the gradient over time; 0 holds it still. strength (0–1) fades the result over the original. Alpha kept.
Parameters
| Name | Type | Notes |
|---|---|---|
slots | `{ |
palette: PropRef
colorLow: PropRef
colorMid: PropRef
colorHigh: PropRef
speed: PropRef
contrast: ArgSpec
blackPoint: ArgSpec
whitePoint: ArgSpec
strength: PropRef
colorSpace: PropRef
}` | |
Example
effect: gradientMap({palette: p('palette'), colorLow: p('colorLow'), colorMid: p('colorMid'), colorHigh: p('colorHigh'), speed: p('speed'), contrast: p('contrast'), blackPoint: p('blackPoint'), whitePoint: p('whitePoint'), strength: p('strength'), colorSpace: p('colorSpace')})
Tip. Declare
identityWhen: isZero('strength').
See also
duotone— Repaint the child in two colors:colorAfor the shadows,colorBfor the highlights.tritone— Repaint the child in three colors:colorAfor the shadows,colorBfor the midtones,colorCfor the highlights.