Thick Line (Experimental)

Draw a line with thickness

Log in to post a comment.

Canvas.setpenopacity(1);

// Global code will be evaluated once.
const turtle = new Turtle();

//Snowflake attributes
const lineThickness = 50;    // min=1, max=256, step=1
const lineLength = 70; // min=1, max=100, step=1

//Set pen to centre of the screen
resetPen();

// The walk function will be called until it returns false.
function walk(i) {
    generateLine();
    return i;
}

function resetPen(x = 0, y = 0)
{
    turtle.penup();
    turtle.goto(x,y);
    turtle.pendown();
}

function generateLine()
{
    for(i = 0; i < lineThickness; i++)
    {
        turtle.forward(lineLength);
        j = (i % 2 > 0) ? i : i * -1;
        x = 0
        y =  - (j / 12) ;
        resetPen(x,y)
    }

}