β¬ Boolean To Float
The yes/no to number adapter, float edition
- result
Same idea as its integer sibling, different output type. Boolean To Float [Dream] takes a boolean and returns one of two floats: on_true (default 1.0) when the condition is true, on_false (default 0.0) when it's false. It's the adapter you reach for when a node wants a FLOAT but all you have is a yes/no.
How it works
A two-way switch, pure and simple. The defaults give you the classic 1.0 / 0.0 mapping, but both values are editable - so "true" can become 0.8 (a dimmed state) and "false" 0.2, if that's what your graph needs. One input boolean, one output: result, a FLOAT.
The inputs
- boolean - the condition to test.
- on_true - FLOAT, default 1.0.
- on_false - FLOAT, default 0.0.
Where it fits
Floats are the natural currency of animation parameters - zoom rates, weights, curve values - so this node shows up wherever you're gating a parameter on a condition. Gate a zoom on "first frame or not", map a comparison result into a weight, or feed one into Image Motion [Dream] to toggle between two motion strengths. It's the same pattern as Boolean To Int, just for the float side of your graph. If you need an integer out of a boolean instead, that sibling is one node over in the same switches category.
Installing it
Ships with Dream Project Animation Nodes - ComfyUI Manager (search Dream Project Animation) or clone https://github.com/alt-key-project/comfyui-dream-project into custom_nodes, pip install -r requirements.txt, restart. No model downloads.
Common issues
Truly minimal failure surface here: the boolean must come from upstream (the node won't invent one), and the mapping is whatever you set. One subtle thing worth knowing - a float output won't connect to an INT-only input, so if your downstream wants a whole number, use the int version rather than rounding a float. That's the whole list.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| boolean | BOOLEAN | false | β |
| on_true | FLOAT | 1.00 | β |
| on_false | FLOAT | 0.00 | β |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| result | FLOAT | β |