Calculate Frame Offset π π π
The frame-indexing math helper that keeps multi-batch animations honest
- INT
Calculate Frame Offset is a small arithmetic helper that exists to solve a specific, fiddly problem: when your animation processes several latent inputs per "step" instead of one, how do you figure out which actual frame index you're on for each input? It's the kind of node you only install a helper for after you've built the workflow once and gotten the indexing wrong by one.
It takes four integers - current_frame, max_frames, num_latent_inputs, and index - and returns a single INT: the frame number to use for latent input index at the given current_frame. On frame zero it simply returns index. Past that, it computes:
start_frame = (current_frame - 1) * (num_latent_inputs - 1) + (num_latent_inputs - 1)
output = (start_frame + index) % max_frames
In plain English: it assumes each "logical frame" spans several latent chunks, skips ahead to the start of the current chunk, offsets by which input you're asking about, and wraps around max_frames so the animation loops cleanly. The modulo is doing real work there - it's what makes looping animations not run off the end of the schedule.
Where it slots in
This is the workflow that ships in the pack's Noisy Latent Composition example: a value schedule drives a latent composite node's X position, and because the composite consumes several latents per step, you need to know which schedule entry each latent should read. Calculate Frame Offset hands you that frame number, which you feed into the per-frame scheduler (the non-batch Value Schedule, or as the current_frame for a point-sample node). If your workflow doesn't have that multi-latent-per-step structure, you don't need this node at all - it's pointless outside that shape.
Notes
The inputs are plain widgets, so you'll wire current_frame and max_frames from wherever your animation loop tracks them, and hard-set num_latent_inputs and index per branch of the graph (one Calculate Frame Offset per latent input, each with a different index). It's pure integer math - no models, no dependencies beyond the pack - and if the output ever looks off by one, check whether you're feeding it 0-based or 1-based frames, because the formula assumes 0-based.
Install
cd ComfyUI/custom_nodes && git clone https://github.com/FizzleDorf/ComfyUI_FizzNodes.git
cd ComfyUI_FizzNodes && pip install -r requirements.txt
Or install "FizzNodes" through ComfyUI Manager and restart. It's a helper you'll probably only encounter by loading someone's Noisy Latent Composition workflow - but when you do, now you know what it's counting.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| current_frame | INT | 0 | β |
| max_frames | INT | 18 | β |
| num_latent_inputs | INT | 4 | β |
| index | INT | 4 | β |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| INT | INT | β |