Created
April 14, 2020 16:38
-
-
Save peterwake/2b8941063763f4c23025e4b530e901a6 to your computer and use it in GitHub Desktop.
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
//openjscad.org | |
// Anna and Charlie's spral | |
function main () { | |
const twist = 45; | |
let i = 0; | |
let delta = 1; | |
var w = [ ]; | |
for(var h = 0; h < 100; h++) { | |
w.push( | |
color('burlywood', cube({ | |
size: [30, 6, 2], | |
center: [15, 3, 1] | |
}).translate([0, -18 - i * 2, 1 + h*2]) | |
.rotateZ(h * twist)) | |
); | |
w.push( | |
color('burlywood', cube({ | |
size: [30, 6, 2], | |
center: [15, 3, 1] | |
}).translate([0, 18 + i * 2, 1 + h*2]) | |
.rotateZ(h * twist)) | |
); | |
w.push( | |
color('burlywood', cube({ | |
size:[30, 6, 2], | |
center: [15, 3, 1] | |
}) | |
.rotateZ(90) | |
.translate([-18 - i *2, 0, 1 + h*2]) | |
.rotateZ(h * twist)) | |
); | |
w.push( | |
color('burlywood', cube({ | |
size: [30, 6, 2], | |
center: [15, 3, 1] | |
}) | |
.rotateZ(90) | |
.translate([18 + i *2, 0, 1 + h*2]) | |
.rotateZ(h * twist)) | |
); | |
i = i + delta; | |
if(h > 0 && h % 8 === 0) { | |
delta = -delta; | |
} | |
} | |
return w; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment