Built-in functions
A tour of the function library you can call from any Expression — grouped by what you'd reach for it to do.
The function set is large and the full list is generated straight from the app, so treat this page as a friendly map rather than an exhaustive index. When you start typing a name in an Expression, the palette suggests matching functions and shows their arguments — that live hint is always the most up-to-date reference.
Everything below works the same whether you're shaping a single number on a parameter or running per-element across a whole collection. Functions apply component-wise, so abs(@P) flips every axis of a position at once.
Maths
The everyday number-crunching kit: sin cos tan sqrt pow exp log abs floor ceil round fract sign, plus min max clamp and saturate (clamp to 0–1).
For shaping values you'll lean on the interpolation and remapping helpers:
// fade in over the first second
@opacity = smoothstep(0, 1, @time);
// bounce a value between two ranges
@scale = remap(@noise, 0, 1, 0.5, 2.0);
// blend two values by t
@y = mix(@a, @b, 0.5);
There are also handy wave shapers for animation and patterns — triangle_wave, sawtooth, square_wave, gaussian, sigmoid — and curve shapers like bias, gain, pingpong, repeat, and quantize (snap to steps). A full family of easing functions (ease_in_out_cubic, ease_out_elastic, and friends) is on hand for natural-feeling motion.
hash(x) turns any number into a stable pseudo-random value — perfect for giving each element its own constant "personality" that doesn't flicker frame to frame.
Vectors
Functions for working with directions and positions: dot, cross, length, distance, normalize, and the optics pair reflect and refract.
// distance from each point to the origin
@dist = length(@P);
// face a point toward a target
@dir = normalize(@target - @P);
Colour
Convert and tweak colour: rgb_to_hsv / hsv_to_rgb, luminance (perceived brightness), desaturate, invert_color, contrast, gamma_correct, and kelvin_to_rgb for warm/cool light temperatures.
// shift hue while keeping saturation and value
hsv = rgb_to_hsv(@Cd);
hsv.x = fract(hsv.x + 0.1);
@Cd = hsv_to_rgb(hsv);
Colour in DNA is handled in a consistent working space behind the scenes, so the linear/sRGB conversion helpers (srgb_to_linear, linear_to_srgb) are only needed for special cases. See Colour management.
Noise
Noise gives you organic randomness for displacement, texture, and motion. noise() is the quick one-liner for parameters and simple offsets. For richer, layered results use the fractal family: fbm (classic cloudy detail), turbulence (billowy, smoke-like), ridged (sharp veins and ridges), billow, and warped_noise for swirling distortion.
// drift each point with smooth 3D noise
@P.y += fbm(@P * 0.5, 4, 2.0, 0.5) * 10;
For heavy, art-directable noise across geometry, the dedicated Noise node is often easier than hand-writing it — but these functions are perfect for quick offsets inside an Expression.
Sampling and fields
Read values from elsewhere with sample (pull from a field or texture at a position) and the field helpers sample_field, field_extract, and field_blend.
// push points along a vector field
@P += sample(velocity_field, @P) * @time;
See Fields & sampling for the bigger picture.
Neighbours
Spatial lookups let each element react to the ones around it. nearest returns the index of the closest point within a radius; nearby counts how many neighbours fall inside a radius.
// fade out crowded points
@opacity = 1.0 / (1.0 + nearby(@P, 5.0));
These power flocking, clustering, and any "look at who's around me" effect.
Sorting and scattering
Reshape whole collections: sort (order by a key), scatter (shuffle), sample (random subset), distinct (drop duplicates), plus reverse, take, skip, flatten, enumerate, zip, interleave, concat, and append.
// keep the 50 elements closest to the camera
sorted = sort(@input, length(@P - $cam_pos));
@output = take(sorted, 50);
For custom per-element logic there are also higher-order functions — map, filter, reduce, scan, and fold — that take a small inline function and run it across a collection.
Strings
Build and pick apart text: join, split, substring, contains, index_of, string_replace, str_case, trim, strlen, and format for assembling labels. to_float / from_float convert between text and numbers.
@label = format("frame {}", frame_index());
Time
Functions that reach across frames for animation and simulation: prev (last frame's value), accumulate (running total over time), history (a window of past values), and frame_index (the current frame number).
// smooth a jittery input toward its previous value
@smoothed = mix(prev(@smoothed), @raw, 0.2);
See Time & playback and Loops & feedback for how these fit together.
Store operations
The store is a small persistent table you can write to and read back across elements or frames — handy for IDs, counters, and lookups. Use store_insert, store_lookup, store_update, store_delete, and store_collect.
// remember a per-id value and read it back
store_insert(@id, @P);
@target = store_lookup(@id);
The store shines for "give each thing a stable identity" problems — assigning an id on birth and recalling its data later, even after the collection has been reordered.
See also
The Expression language — the Expression editor and how to write one
Expression attributes — reading and writing
@attributesGlobals & parameters —
$time,$frame, and other globalsExpression cookbook — ready-to-use recipes