Repeat
Repeat
The Repeat wrapper executes its input subgraph multiple times,
generating loops that control growth, branching, or decoration.
Unlike the low-level repeat_core
, this wrapper introduces begin/end blocks,
a friendlier interface, and direct integration with mappings and sockets.
Concept
- Encapsulates a subgraph between
Repeat Begin
andRepeat End
. - Iterates the subgraph N times (
repeat_count
). - Exposes the normalized loop index
u
[0..1], which is critical for mapping. - Supports fractional iteration via
fraction
, allowing partial loops.
This is how long stems, stacked segments, or layered patterns are built in Natsura.
Inputs
Input 0 — Graph
The incoming Apex graph.
Subgraph (Begin → End)
Nodes placed between Repeat Begin
and Repeat End
are executed iteratively.
Output — Graph
The modified graph with repeated internodes, ready for downstream growth or Simulate.
Parameters
- Repeat Count (
repeat_count
)
Number of iterations. Each iteration appends new internodes to the graph. - Fraction (
fraction
)
Optional multiplier. Realized steps =floor(fraction × repeat_count)
. - Delay (optional, advanced)
Used for staggered iteration across multiple branches.
Attributes
Repeat introduces or modifies:
u
– normalized loop index, resets each Repeat.repeat_index
– integer iteration counter.- Any attributes created in the subgraph are evaluated per iteration.
Workflow
- Drop a Repeat Begin node.
- Add one or more nodes (e.g. Grow) inside the block.
- Close with Repeat End.
- Adjust
repeat_count
and mapu
to control per-step variation.
How-tos
Simple segmented stem
- Place a Grow node inside Repeat.
- Set
repeat_count = 5
. - Map
u
to taper width along the iterations.
Fractional growth
- Same as above, but animate
fraction
from 0 → 1. - The stem appears to “grow” step by step.
See also
- Grow – often used inside Repeat
- Split – forking branches alongside iteration
- Switch – state-based iteration control
- Repeat Core – the underlying primitive
Prune
Removes branches or internodes when conditions are met. Prune re-evaluates conditions across a test lifetime, optionally with a delay, making it useful for density control, age-based cleanup, or time-varying growth logic.
Repeat (Core)
Iterates a child graph for N steps, producing normalized indices for mapping.