Nodes/Chaosaiart-Nodes/🔶 Any Switch, by Frame
ComfyUI Node

🔶 Any Switch, by Frame

Alternate two inputs as your frame count climbs

By chaosaiart·Created 2 years ago·Updated about a year ago· 117
🔶 Any Switch, by Frame
  • source_1
  • source_2
  • restart
  • Info
  • SOURCE_X
◄mode▾►

Chaosaiart's whole pack is built around a specific, slightly unusual idea: generate one image per queue run ("frame," in their vocabulary, not a video-timeline frame), and let nodes react to which run you're on. This node is the simplest version of that reaction - it holds two sources and flips between them as the count goes up, driven entirely by the queue itself rather than a widget you click.

It's the node behind the "Any-Switch to control any input at any time" workflow in the README - the idea being you can drive literally any wire in your graph (a checkpoint, a prompt, an image, whatever) off a running counter, without touching AnimateDiff or a real video model. It's a much cruder tool than temporal motion - no coherence, no interpolation, it just swaps which upstream thing feeds the rest of the graph - but it's cheap, and for testing two variants back to back in a batch queue it does the job.

Inputs and outputs

  • mode - pick one of two behaviors: "One Time: 1-2-2-2.." flips from source_1 to source_2 once and stays there, or "Switch: 1-2-1-2.." alternates every frame. This is the one setting you'll actually think about.
  • source_1, source_2 - your two wildcard-typed inputs. Anything goes: images, conditioning, model, whatever the downstream node expects.
  • restart (optional, RESTART type) - a reset signal. Wire in a RESTART output (Chaosaiart's convert node produces one) to reset the switch's internal count back to the start rather than letting it run forever.
  • Outputs: Info (a string, useful for debugging what state it's in) and SOURCE_X - whichever of the two sources is currently active.

Note restart is its own custom type, not a boolean - it only connects to other Chaosaiart nodes that emit RESTART, not a generic bang/trigger from another pack.

Installing it

Via ComfyUI Manager: Install via Git URL → https://github.com/chaosaiart/Chaosaiart-Nodes - that's the method the README documents. A plain search for "Chaosaiart" should also surface it.

Manual:

cd ComfyUI/custom_nodes
git clone https://github.com/chaosaiart/Chaosaiart-Nodes

Then on Linux (activate your venv first if you use one):

pip install opencv-python
pip install tqdm

Windows has an Install_windows script in the folder that covers the same two packages. Restart ComfyUI. No model downloads involved.

Common issues

It's not switching when you expect. "Frame" here means one full run through the queue - if you're only ever running one generation at a time and re-queuing manually, the internal counter still advances, but if you were expecting it to react to a video's actual frame timeline (like an AnimateDiff or Wan batch), that's a different thing entirely and this node has no concept of it.

Nothing resets between runs. Without a restart wired in, the switch just keeps counting up across every queue you run in that session - if you close and reopen the workflow expecting it to start fresh at source_1, it won't unless you feed it a RESTART signal or reload the graph.

One Python module, one point of failure. All ~20 nodes in this pack share one module. If opencv-python or tqdm failed to install, the whole pack - not just this node - won't show up in ComfyUI. Check the startup console for an import error before assuming the node's missing for some other reason.

Category🔶Chaosaiart/switch

Inputs (4)

NameTypeDefaultDescription
modeCOMBO2 options: One Time: 1-2-2-2.., Switch: 1-2-1-2..
source_1*—
source_2*—
restartoptRESTART—

Outputs (2)

NameTypeDescription
InfoSTRING—
SOURCE_X*—