ReferenceScript nodesUtilities › Flow Control
For Each Layer
Does body once for each layer of the scene, with its name.
↻For Each Layer
Loop Body
Layer Name
Index
Completed
Inputs
| Pin | Type | Starts at | Notes |
|---|---|---|---|
in | what happens next | – | – |
Outputs
| Pin | Type |
|---|---|
Loop Bodybody | what happens next |
Layer Namename | text |
Indexindex | number |
Completeddone | what happens next |
The code it becomes
The graph below written as a script would write it.
let s2_name = "";let s2_index = 0;// On Scene StartL2: for (let i = 0, L = scene.layers; i < L.length; i++) { s2_name = String(L[i].name || L[i].id); s2_index = i; scene.log(s2_name);}In a graph
◆On Scene Start
↻For Each Layer
Loop Body
Layer Name
Index
Completed
ƒPrint
In Text
The node with what starts it and Print to show what it gives, as Studio draws them.
Related
Notes from the community
Written by creators and checked by the docs' editors. Not part of Motion's official reference.