Nodes/Deforum Nodes/(deforum) Iterator Node
ComfyUI Node

(deforum) Iterator Node

The stateful engine that drives every frame of a Deforum animation

By XmYx·Created 3 years ago·Updated 3 months ago· 198
(deforum) Iterator Node
  • deforum_data
  • latent
  • init_latent
  • deforum_frame_data
  • latent
  • positive_prompt
  • negative_prompt
latent_type
seed0
subseed0
subseed_strength0.80
slerp_strength0.10
reset_counterfalse
reset_latentfalse
enable_autoqueuefalse

If the Integrated Pipeline is the "one button" Deforum experience, (deforum) Iterator Node is the engine room you expose when you want to wire your own sampling graph into the loop. It's the stateful heart of the node-based workflow: it remembers which frame you're on, computes that frame's seed, prompt, and denoise strength, manages the latent RNG, and hands everything to the next nodes in the form of DEFORUM_FRAME_DATA. Every pass through the graph, it advances.

How it works

The Iterator keeps the animation's state on itself - frame_index, first_run/second_run flags, a seed list, an RNG. Each execution it:

  1. Builds the full Deforum args (DeforumAnimKeys and friends) from the deforum_data you feed in.
  2. Works out the current frame's seed from the seed schedule (or a fresh random one if seed_behavior is random), and its prompt from the prompt keyframe series - including an exponential blend toward the next prompt change, so prompt transitions morph instead of cutting.
  3. Maintains a latent noise RNG (ImageRNGNoise) and, when slerp_strength > 0, slerps the previous latent toward fresh noise - that's the mechanism behind Deforum's signature evolving-texture look.
  4. Emits deforum_frame_data containing everything the sampler needs: prompt, negative, cfg, steps, denoise, seeds, the frame index, and the anim_args for the warp/cadence nodes.

It also handles the loop reset dance: reset_counter restarts the frame counter, reset_latent clears the latent cache and starts a fresh RNG (that's the reset flag other nodes check).

The inputs and outputs that matter

  • deforum_data - the accumulated parameters from your parameter-node chain. Without this, the Iterator has nothing to animate.
  • latent_type - stable_diffusion, stable_cascade, or sd3. Picks the right latent channel count and compression for your model family. Get this wrong and your latents will be nonsense.
  • seed / subseed / subseed_strength (optional) - the animation's base seed and the subseed for the RNG noise. subseed_strength (default 0.8) is how strongly that noise source varies.
  • slerp_strength (optional, default 0.1) - how hard previous-frame latents blend toward fresh noise each step.
  • init_latent (optional) - a starting latent; on frame 0 the animation denoises from this instead of pure noise.
  • reset_counter / reset_latent (optional BOOLEAN) - manual loop restarts.
  • enable_autoqueue (optional BOOLEAN) - when true, the node's UI asks ComfyUI to auto-queue the next pass, which is how a long animation runs unattended: queue once, walk away.

Outputs:

  • deforum_frame_data (DEFORUM_FRAME_DATA) - the per-frame payload; feeds (deforum) KSampler, (deforum) Frame Warp, (deforum) Cadence Interpolation, and the conditioning nodes.
  • latent (LATENT) - the current latent to sample from.
  • positive_prompt / negative_prompt (STRING) - this frame's prompts, for your CLIP encode / conditioning nodes.

Installing this pack

Part of Deforum Nodes by XmYx. ComfyUI Manager: search Deforum Nodes, or:

cd ComfyUI/custom_nodes
git clone https://github.com/XmYx/deforum-comfy-nodes

Restart, let install.py pull the deforum-studio backend from GitHub plus the scientific-Python stack (numpy < 2.0, Python 3.10 required). No models are downloaded by this node itself.

Common issues

  • Frame counter never advances / stuck at frame 0. The Iterator is OUTPUT_NODE-marked and relies on being re-executed each pass. If enable_autoqueue is off and you queue once, it runs once. Turn on auto-queue or keep re-queuing.
  • Wrong latent_type. stable_cascade/sd3 use 16 latent channels and different compression than SD's 4; feeding SD latents into the wrong type produces garbage. Match it to your checkpoint.
  • Animation "forgets" and restarts. That's reset_latent/gs.reset doing its job - if it resets mid-animation unexpectedly, look for a node upstream that flags reset (e.g. the cache-load nodes returning None on reset).
Categorydeforum/logic

Inputs (11)

NameTypeDefaultDescription
deforum_datadeforum_data
latent_typeCOMBO3 options: stable_diffusion, stable_cascade, sd3
latentoptLATENT
init_latentoptLATENT
seedoptINT00–18446744073709550000
subseedoptINT00–18446744073709550000
subseed_strengthoptFLOAT0.800–1
slerp_strengthoptFLOAT0.100–1
reset_counteroptBOOLEANfalse
reset_latentoptBOOLEANfalse
enable_autoqueueoptBOOLEANfalse

Outputs (4)

NameTypeDescription
deforum_frame_dataDEFORUM_FRAME_DATA
latentLATENT
positive_promptSTRING
negative_promptSTRING