mx_timer
An alias that returns the built‑in time node (elapsed seconds), used to drive time‑based animation in TSL.
Core Advantages
MaterialX‑aligned naming for easy porting from MTLX graphs; exposed as a read‑only, auto‑updated UniformNode so no JS clock or uniform management is needed.
Common Uses
Time input for periodic functions (breathing glow, pulses, flicker).
Texture scrolling, UV distortion, ripples, and other procedural animation.
Vertex displacement over time (flags, water, sway).
Loop/phase logic via fract() or mod().
How to adjust
mx_timer is read‑only. Shape behavior by applying math to its output: multiply to change speed (mx_timer().mul(speed)), add to shift phase (mx_timer().add(phase)), use fract()/mod() for loops (mx_timer().mul(freq).fract() or mod(mx_timer(), period)), and gate with smoothstep()/step() for triggers.
Code Examples
1
2<mesh>
3 <torusKnotGeometry args={[0.5, 0.16, 256, 64]} />
4 <meshStandardNodeMaterial
5 // Breathing emissive: abs( sin( mx_timer * 2.5 ) )
6 emissiveNode={TSL.color(0x00ffff).mul( TSL.sin( TSL.mx_timer().mul(2.5) ).abs() )}
7 // Periodically modulate metalness in [0,1]
8 metalnessNode={TSL.sin( TSL.mx_timer() ).mul(0.5).add(0.5)}
9 />
10</mesh>
11