Graph Editor · Expressions

// Expression language

Expressions

One node, a whole toolbox. The Expression node runs a tiny sandboxed language over telemetry — this page is its full reference: the grammar, every function with an example, and a search box to find the right one fast.

Reference · searchable

Find a function

Search by name or by what you want to do — “blend two colours”, “front montant”, “decimals” — or browse by category.

Back

Node wiki

The Expression node entry, and every other node in the graph editor.

Reference

Expression language

Write one or more statements separated by ; — the node grows the sockets it needs. Bare names become inputs, $name = … declares an output, @channel reads telemetry directly. Numbers, vectors, colours, text and time, all in one place.

▸

Grammar

SyntaxMeaningExample
nameBare name never assigned → input socketrpm / rpmMax
name = …;Local variable (no socket)ratio = rpm / rpmMax;
@channelReads a telemetry channel directly (read-only, no wire)@gear · @speed_kmh
$name = …;Declares a named output socket — the only way to make one. No $ = no output.$shift = ratio > 0.95;
.x .y · .r .g .b .aComponent access — vector / colour (colour 0–255)$dir.x = vel.x * 2
A fresh node starts with $out = value — replace it with your own program. The editor colours the syntax live and autocompletes functions, constants and @channels as you type.
▸

Types

Socket types are inferred from how you use a name — there is nothing to declare:

  • Plain arithmetic → number.
  • .x .y on a name → vector socket.
  • .r .g .b .a on a name, or a bare name fed to mixcolor() → colour socket.
  • An output assigned from rgba() / mixcolor() → colour output.
  • An output assigned text ("…", str(), format()) → text output — feed it to a Text display.

Typing is soft: using a colour in arithmetic yields NaN, not an error. Text flows out of the node only — text input sockets are not supported.

▸

Operators & constants

  • Arithmetic + - * / % ^ — + concatenates when either side is text: "P" + str(pos).
  • Comparisons == != < <= > >= · logic && || !.
  • Ternary cond ? a : b — chains nicely: g == 0 ? "N" : g == -1 ? "R" : str(g).
  • Constants PI and E.
▸

Functions

Type to filter — by name, or by what you're trying to do (French works too: « mélange », « front montant », « décimales »). Click a category to narrow down.

Math

min(a, b, …)

Smallest of the values. min(@fuel_level, 20)

max(a, b, …)

Largest of the values. max(0, delta)

clamp(x, lo, hi)

Bound x to [lo, hi]. clamp(@rpm / 8000, 0, 1)

abs(x)

Absolute value. abs(@delta)

sign(x)

-1, 0 or 1 by sign. sign(@delta)

floor(x)

Round down. floor(@lap_time / 60)

ceil(x)

Round up. ceil(laps_left)

round(x)

Round to nearest. round(@speed_kmh)

trunc(x)

Truncate toward zero. trunc(-1.7) → -1

fract(x)

Fractional part, x - floor(x). fract(elapsed())

sqrt(x)

Square root. sqrt(gforce)

Trigonometry radians — convert with deg / rad

sin(x)

Sine, x in radians. $y = sin(elapsed() * 2 * PI)

cos(x)

Cosine, x in radians. $x = cos(angle) * r

tan(x)

Tangent, x in radians.

asin(x)

Arc sine → radians.

acos(x)

Arc cosine → radians.

atan(x)

Arc tangent → radians.

atan2(y, x)

Angle of (x, y), quadrant-aware. atan2(vel.y, vel.x)

deg(x)

Radians → degrees. deg(atan2(y, x))

rad(x)

Degrees → radians. sin(rad(steer_deg))

Exponentials & logs

exp(x)

ex. exp(-t) for decay curves.

log(x)

Natural log (base e).

log2(x)

Log base 2.

log10(x)

Log base 10. $db = 20 * log10(v)

pow(a, b)

a to the power b — same as a ^ b. pow(t, 3)

hypot(a, b, …)

Euclidean length √(a² + b² + …). hypot(vel.x, vel.y)

Interpolation

lerp(a, b, t)

Linear blend from a to b, t ∈ 0–1. lerp(0, 270, ratio) for a needle angle.

remap(x, inLo, inHi, outLo, outHi)

Re-map x from one range to another. remap(@rpm, 0, 8000, 0, 1)

smoothstep(lo, hi, x)

Eased 0→1 as x crosses [lo, hi]. smoothstep(0.7, 0.95, ratio)

Colour

rgba(r, g, b, a?)

Build a colour — components 0–255, alpha optional. $c = rgba(255, 80, 0)

mixcolor(c1, c2, t)

Blend two colours, t ∈ 0–1. Bare names passed in become colour inputs. $c = mixcolor(cold, hot, heat)

Text

str(x)

Number → text; concatenate with +. $label = "P" + str(@position)

format(x, decimals)

Fixed decimals. format(@fuel_level, 1) → "42.3"

State & time per call site — see semantics

prev(x)

Value of x on the previous tick. $dv = x - prev(x)

changed(x)

true on the tick x changes (any direction). changed(@gear)

rising(x)

true on the tick x increases. rising(@flag)

falling(x)

true on the tick x decreases. $better = falling(@delta)

pulse(trig, dur_s)

true for dur_s seconds after a rising edge of trig (re-trigger restarts). pulse(changed(@flag), 3)

blink(freq_hz, duty?)

Square wave at freq_hz; duty 0–1, default 0.5. ratio > 0.95 ? blink(6) : 0

elapsed()

Seconds since the dashboard started rendering. sin(elapsed() * 2 * PI)

▸

State & time — how it behaves

  • Each call site keeps its own state — two blink() in one program are two independent oscillators.
  • Time advances with telemetry ticks — paused telemetry = frozen timers, same as the Pulse / Blink nodes.
  • A call inside a ternary branch that is not taken this tick keeps its state frozen (a gated blink() resumes where it left off).
  • Editing the expression resets stateful slots — transient, editor-only.
▸

Recipes

Coloured exactly like the editor — outputs, channels, functions, numbers each in their own hue (see the colour key).

GoalProgram
Shift light that flashes near the limiterratio = @rpm / 8000; $on = ratio > 0.95 ? blink(6) : 0; $col = mixcolor(rgba(0,255,0), rgba(255,0,0), smoothstep(0.7, 0.95, ratio))
Gear label with N / R$g = @gear == 0 ? "N" : @gear == -1 ? "R" : str(@gear)
Warning held 3 s after a flag$warn = pulse(changed(@flag), 3)
Delta trend arrow input$better = falling(@delta)
Fuel laps left, one decimal$laps = format(@fuel_level / max(0.1, @fuel_used_per_lap), 1)
Needle sweep angle$angle = lerp(-120, 120, clamp(@rpm / 8000, 0, 1))
▸

Colour key

The editor and the Properties panel colour the source the same way:

clamp function 8000 number "R" string @rpm channel $shift output .x .r component PI constant rpm variable + * operator
▸

Sandbox

Whitelisted by design: only the functions on this page run, and arbitrary member/index access is locked down — an expression can't reach outside its sandbox. random, hyperbolics and array helpers stay blocked.