Dandelion

self explanatory

Log in to post a comment.

// You can find the Turtle API reference here: https://turtletoy.net/syntax
Canvas.setpenopacity(1);

// Global code will be evaluated once.
const turtle = new Turtle();
const radius =43; // min=2, max=150, step=1
const seedlength=6; // min=2, max=20, step=1
const seedhairs=10 // min=2, max=100, step=1
const numseeds=350; // min=2, max=1000, step=1

function randomNumber(min, max) {
    return Math.random() * (max - min) + min;
}

function createVector() {
    let r = randomNumber(radius-radius*0.05,radius+radius*0.05);
    let f = randomNumber(0,Math.PI*2);
    let q = randomNumber(0,Math.PI/2);  
    let point = new Array(r*Math.sin(f)*Math.cos(q),r*Math.sin(f)*Math.sin(q),r*Math.cos(f));
    return point;
}

    
// The walk function will be called until it returns false.
function walk(i) {
    turtle.jump(0,0);
    let newpoint=createVector();
    turtle.pendown();
    turtle.goto(newpoint[0],newpoint[2]);
    for (let j=0; j < seedhairs; j++) {
        turtle.setheading(randomNumber(0,360));
        turtle.forward(seedlength);
        turtle.jump(newpoint[0],newpoint[2]);
    }
    return i<numseeds;
}