While (LogiX node)
While | ||
---|---|---|
![]() | ||
Inputs | ||
Impulse | Run | |
Bool | Condition | |
Outputs | ||
Impulse | LoopStart | |
Impulse | LoopIteration | |
Impulse | LoopEnd |
The While node is used to fire impulses from the LoopIteration
output until the Condition
becomes True after an impulse is received at Run
.
Usage
The LoopStart
output fires an impulse once after an impulse is received at Run
. The impulse chain will complete before any impulses are fired from LoopIteration
.
The LoopIteration
output fires impulses sequentially until the Condition
becomes False. Each impulse chain started from LoopIteration
completes before the following one is fired.
The LoopEnd
output fires an impulse once the final impulse chain started from LoopIteration
has ended.
Note that all impulse chains started from this node effectively continue the one which arrived at Run
, meaning that any temporary values from previous nodes are still available. All iterations from LoopIteration
complete within a single frame update and therefore this can produce framerate hitches if an excessively demanding computation is performed. There is a failsafe which will put this node into an error state (node visual turns red) if a frame is delayed excessively - this helps prevent complete freezes. Use Secondary on While (R on desktop) to clear the error state.
Examples
The While node is useful when looping and the required number of iterations cannot be determined in advance. If similar looping behavior is required, but the number of required iterations can be fixed, use the For node instead.