CWK Wan2.2 Loop Close
The other half of the Wan 2.2 loop — where the video actually gets stitched
- loop_state
- new_images
- new_latent
- images
- final_latent
If Loop Open is the front door of the pack's looping pipeline, Loop Close is the exit turnstile - and the part that actually makes the video. It takes each freshly generated clip, cross-fades it into the running accumulation, and either re-queues for the next clip or, when every clip is done, returns the finished video. It's an output node (the only one in the pack), so it sits at the end of your graph feeding a video-combine node. Most of what you tune lives in Loop Open; Loop Close is where you watch the seams disappear or not.
What it does, mechanically
Loop Close receives three things: the loop_state (a WAN22_LOOP_STATE object that Loop Open handed you, carrying the pipeline and your overlap settings), new_images (the clip you just generated), and new_latent. It blends new_images into the accumulated video using the overlap settings that were set back at Loop Open - overlap frames of cross-fade, with overlap_mode picking the blend:
blend_linear- straight linear cross-fade (default).blend_sqrt- square-root weighted, a softer, longer-feeling transition.replace- hard cut, no blending. There for when you want the jump cut.
overlap_side is the subtle one: start blends the head of the new clip with the tail of the accumulated video (a continuation), while end blends the tail of the new clip with the head (a true loop, where the last shot leads back into the first). If you've ever fought the "ping-pong" effect trying to get a seamless Wan loop, this is the parameter that decides whether you get one.
When there are clips left, Loop Close advances the state and asks ComfyUI to re-queue itself (via a cwk_wan22_loop_continue event that the pack's frontend turns into an automatic queue). When the last clip lands, it clears the session and hands you the finished images plus final_latent.
The final_only switch
This is the input most people trip over. With final_only true (the default), every intermediate loop pass outputs a single black placeholder frame instead of the partial accumulation. Sounds broken - it isn't. The idea is to keep the video-combine node idle until the whole video is ready, so it encodes once instead of once per clip. Flip it to false and you get the partial accumulation after every clip, which is a great way to preview shots as they finish but will make your video-combine node do work on every pass. If your loop ends up as a black frame, the first thing to check is not the render - it's that this flag is sitting at its default.
Install
Same as the rest of the pack:
cd ComfyUI/custom_nodes
git clone https://github.com/cowneko/CWK_Wan2.2_Nodes.git
or ComfyUI Manager → CWK Wan2.2 Nodes, then restart. No extra Python dependencies. Loop Close is pure backend - no custom UI - but it only understands this pack's WAN22_LOOP_STATE, so it's a dead node without Loop Open in the graph.
Troubleshooting
- Black video at the end -
final_onlywas true and the re-queue never fired, so you only ever saw the placeholder. The auto re-queue needs the pack's frontend JS loaded; if the Composer canvas isn't rendering, the listener isn't there either. Update the pack, hard-refresh, and re-run. Manual re-queues work too, since the session persists. - Seams are visible between clips - raise
overlap(max 32) or switchblend_linear→blend_sqrt; hard cuts mean you chosereplace. - The loop doesn't end - if the pipeline changed mid-run, Loop Open resets to clip 1 and the accumulation restarts. Don't edit the Composer while a loop is in flight.
It's a small, single-author pack with no community around it, and the loop is held together by state that lives outside the graph - a bit fragile, but it's the honest way to get a long Wan 2.2 video out of ComfyUI without babysitting every clip.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| loop_state | WAN22_LOOP_STATE | — | |
| new_images | IMAGE | — | |
| new_latent | LATENT | — | |
| final_only | BOOLEAN | true | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| images | IMAGE | — |
| final_latent | LATENT | — |