Last active
October 30, 2015 17:54
-
-
Save doubleshow/acf73901369b63a9e09b to your computer and use it in GitHub Desktop.
Zigzag Layout
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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