mix

A blend from a to b by t, where 0 gives a and 1 gives b.

mix(a: Val, b: Val, t: Val): Expr

Import math from shaders/std and use math.mix.

Works on numbers and on colors. For two colors, pass t through splat3 to blend every channel by the same amount.

Parameters

NameTypeNotes
aVal
bVal
tVal

Example

const rgb = mix(params.uniforms.colorA.member('rgb'), params.uniforms.colorB.member('rgb'), splat3(coverage))

See also

  • smoothstep — A soft edge: 0 below e0, 1 above e1, an S-curve between.
  • splat3 — One number copied into all three channels of a vec3.

Used by

Aurora, BrushedMetal, CarbonFiber, Chrome, Crystal, FlowingGradient, Frost, Goo, Heatmap, Hologram, Holographic, Irradiance, LiquidMetal, Nebula, Obsidian, PixelThrow, Plastic, Polygon, Prism, ReactionDiffusion, Sparkle, StudioBackground, Voxels, Water, Waveform