Skip to content

Instantly share code, notes, and snippets.

@peterwake
Created April 14, 2020 16:38
Embed
What would you like to do?
//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