Playing with snowflake parameters. Try your own variations.
Log in to post a comment.
// You can find the Turtle API reference here: https://turtletoy.net/syntax
Canvas.setpenopacity(1);
const width = 1;
const length = 40;
const max_depth = 6;
const grid = 10;
const da = -2;
const dscale = 0.1;
// Global code will be evaluated once.
const turtle = new Turtle();
turtle.penup();
turtle.goto(5,0)
turtle.pendown();
function flake(len, wid, num, depth) {
turtle.right(30*(num-3));
for (let i=0;i<num;i++) {
turtle.right(60-da)
turtle.forward(len);
if (num==3 && i==0)
turtle.forward(len*dscale)
if (depth >= max_depth) {
turtle.left(90-da);
turtle.forward(wid);
turtle.left(90-da);
} else {
turtle.right(da)
flake(len/1.8, wid, (depth<=2)?5:3, depth+1);
turtle.right(da)
}
turtle.forward(len);
if (num==3 && i==2)
turtle.forward(len*dscale)
turtle.right(60-da);
}
turtle.right(30*(num-3))
}
// The walk function will be called until it returns false.
function walk(i) {
flake(length,width,6,1)
}