float

A plain number as an expression.

float(n: number): Expr

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

Rarely needed: every word here accepts numbers directly. Reach for it when something wants an expression and you only have a constant.

Parameters

NameTypeNotes
nnumber

Example

const half = float(0.5)

See also

  • vec2 — A 2D vector from two values.
  • vec3 — A 3D vector from three values, often a color without alpha.
  • vec4 — A 4D vector, usually the final color with alpha.

Used by

CarbonFiber, Chrome, Crystal, Frost, Goo, Heatmap, Hologram, Holographic, Irradiance, Nebula, StudioBackground, Water