Skip to content

Instantly share code, notes, and snippets.

@doubleshow
Last active October 30, 2015 17:54
Show Gist options
  • Save doubleshow/acf73901369b63a9e09b to your computer and use it in GitHub Desktop.
Save doubleshow/acf73901369b63a9e09b to your computer and use it in GitHub Desktop.
Zigzag Layout
<craft name="zigzag-layout">
<info>
<title> Zigzag Layout </title>
</info>
<param name="offset" default="5" type="int"/>
<param name="axis" default="x" type="text"/>
<content>
<cube t="translate(0 10 0)"></cube>
<cube t="translate(0 20 0)"></cube>
<cube t="translate(0 30 0)"></cube>
<cube t="translate(0 40 0)"></cube>
<cube t="translate(0 50 0)"></cube>
</content>
<script>
this.children.forEach(function(solid, i){
if (i % 2){
var p = {
x: 0,
y: 0,
z: 0
}
p[$params.axis] = $params.offset
solid.translate(p)
}
})
</script>
</craft>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment