± Frame Counter Offset
Look at the previous frame without re-rendering — shift the counter, not the graph
- frame_counter
- frame_counter
The most useful trick in a frame-by-frame animation is giving the current frame a memory of the one before it. Frame Counter Offset [Dream] is the tiny node that enables it: it takes a frame counter and hands back a new counter shifted by a fixed number of frames, defaulting to -1 - i.e., "the previous frame."
It's part of the Dream Project Animation Nodes pack (alt-key-project), the 2023 Deforum-style animation toolkit. Small, unmaintained, and still exactly what you need.
How it works
Two inputs, one output: frame_counter plus offset (INT, default -1), returning a new frame_counter. In the source it's a single call to incremented(offset) - a brand-new counter with the same total frames and fps but current_frame + offset. The original counter isn't mutated; that's the nice part. You can have one counter feeding several offset branches, each shifted differently, without them fighting.
The default of -1 exists because "give me the previous frame" is the most common request. Need the previous three frames for a longer blend window? Set offset to -3. Want to peek ahead? Use a positive offset.
The classic pattern
The pair it's built for: Frame Counter → Frame Counter Offset (-1) → Image Sequence Loader. The loader pulls frame N-1's image while the main path renders frame N. That previous frame becomes your img2img anchor, which is how Deforum-style animations keep temporal coherence - each frame is generated from the last one rather than from nothing. The offset node exists specifically to make that look-up trivial instead of a wiring nightmare.
You can also use it on curve nodes: evaluate a Sine Curve with a counter shifted by a few frames and you've got a cheap phase-delayed version of the same curve - a second animation layer that's slightly behind the first.
A note on direction
Offsets can push the counter below zero or past the end. The underlying FrameCounter clamps current_frame at 0 on the low side, and an over-the-end counter will make nodes like Image Sequence Loader fall back to their default image (or nothing). For the "previous frame" use case that's rarely a problem - frame 0 has no previous frame anyway.
Installing
cd ComfyUI/custom_nodes
git clone https://github.com/alt-key-project/comfyui-dream-project.git
Or via ComfyUI Manager under "Dream Project Animation". No model downloads; the pack's deps are imageio, scipy, torchvision, pilgram, and evalidate, with a numpy<2.0 pin to watch. Find it under Dream → animation.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| frame_counter | FRAME_COUNTER | — | |
| offset | INT | -1 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| frame_counter | FRAME_COUNTER | — |