Skip to content

Commit 4c66293

Browse files
committed
Convert stack function example to a block
1 parent 1f4b45b commit 4c66293

1 file changed

Lines changed: 11 additions & 11 deletions

File tree

ShapeScriptTests/TestShapes/Stack.shape

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,21 @@
33
detail 32
44

55
// Function to stack shapes automatically
6-
// - Parameter shapes: one or more shapes to be stacked
7-
// - Returns: the stacked meshes, inside a group object
8-
define stack(shapes) {
9-
define axis 0 1 0 // y-axis
10-
group {
11-
for mesh in shapes {
12-
mesh
13-
translate axis * mesh.bounds.size
14-
}
6+
// - Parameters
7+
// - axis: the axis along which to stack the shapes
8+
// - children: one or more shapes to be stacked
9+
// - Returns: the stacked meshes
10+
define stack {
11+
option axis 0 1 0 // y-axis
12+
for mesh in children {
13+
mesh
14+
translate axis * mesh.bounds.size
1515
}
1616
}
1717

1818
// Display stacked objects
19-
stack(
19+
stack {
2020
cube { color red }
2121
sphere { color green }
2222
cone { color blue }
23-
)
23+
}

0 commit comments

Comments
 (0)