Building pentagrams and making a sort of flower looking thing from it
and other shapes :)
Log in to post a comment.
// You can find the Turtle API reference here: https://turtletoy.net/syntax
Canvas.setpenopacity(1);
let a_length = 3;//min=1,max=10,step=0.01
let num_p = 150;//min=0,max=200,step=1
let scale = 1.02;//min=1,max=2,step=0.01
let angle = 72;//min=1,max=359,step=1
let sides = 5//min=3,max=20,step=1
let offset_x = 0//min=-1,max=1,step=0.01
let offset_y = 0//min=-1,max=1,step=0.01
// Global code will be evaluated once.
const turtle = new Turtle();
turtle.penup();
turtle.goto(a_length/2,-a_length/2);
let a_len = a_length;
function draw_pentagon(n, last_len) {
a_len = scale * last_len;
turtle.goto(a_length/2 + offset_x * n,-a_length/2 + offset_y * n);
turtle.pd();
for (let i = 0; i < sides; i ++) {
turtle.right(angle);
turtle.forward(a_len);
}
turtle.pu();
}
function walk(i) {
draw_pentagon(i, a_len);
return i < num_p;
}