select
ifTrue when the condition holds, otherwise ifFalse.
select(cond: Expr, ifTrue: Val, ifFalse: Val): Expr
Import math from shaders/std and use math.select.
Both values are computed at every pixel, so this picks rather than skips work. For a soft transition use mix or smoothstep instead.
Parameters
| Name | Type | Notes |
|---|---|---|
cond | Expr | |
ifTrue | Val | |
ifFalse | Val |
Example
const rgb = select(lt(dist, radius), params.uniforms.fill.member('rgb'), params.uniforms.background.member('rgb'))
See also
lt— True whenais less thanb.gt— True whenais greater thanb.mix— A blend fromatobbyt, where 0 givesaand 1 givesb.