Time Expressions in Houdini
A comprehensive guide to working with time-based expressions and animation controls in Houdini
Basic Time Variables
Houdini provides several built-in variables for working with time:
$F- Current frame number$T- Current time in seconds$TSTART- Start time of the timeline$TEND- End time of the timeline
Boolean Operations
For boolean operations (switch, activation), expressions return either 0 (false) or 1 (true).
Common frame-based conditions:
// Activate after frame 30
$F > 30
// Activate before frame 60
$F < 60
// Activate between frames 30 and 60
$F > 30 && $F < 60Time Shift Operations
You can use max/min functions to create time shifts and clamps:
// Will start at frame x
max($F, x)
// Will stop at frame x
min($F, x)
// Clamp between two frames
min(max($F, start_frame), end_frame)Animation Controls
Create normalized animation values (0-1) based on frame ranges:
// Normalize frames 0-30 to range 0-1
clamp(fit(@Frame, 0, 30, 0, 1), 0, 1)Custom Animation Interpolation
Use attribute wrangle for more control over animation interpolation:
// In an Attribute Wrangle node
float t = clamp(fit(@Frame, ch("frame_start"), ch("frame_end"), 0, 1), 0, 1);
float animation_value = chramp("../CONTROLS/animation_ramp", t);
setdetailattrib(0, "animation_value", animation_value, "set");
// Reference the value in other nodes using:
detail("../CONTROLS", "animation_value", 0)This setup allows you to:
- Control animation timing with custom parameters
- Use ramp functions for non-linear interpolation
- Share animation values across multiple nodes