Continuous line drawing

plot me just one line please

Log in to post a comment.

const turtle = new Turtle();

const grid = 64; // min=4, max=200, step=4
const size = 80;  // min=50, max=100, step=5
const distortionX = 0; // min=0, max=20, step=0.1
const distortionY = 5; // min=0, max=20, step=0.1
const radial = 2.5;
const steps = 2 // min=2, max=8, step=1

function rnd(amount = 1.0) {
   return Math.floor((-0.5 + Math.random()) * steps) / steps * amount;
}

function walk(i) {
    let x = i % grid
    let y = i / grid | 0;
    if (y % 2) x = grid - x;
    
    let tx = x/grid;
    let ty = y/grid;
    
    const pos = [-size+tx*size*2,-size+ty*size*2];
    
    r = (radial * 0.5) - Math.abs(((0.5-tx)**2 + (0.5-ty)**2)) * radial;
    pos[0] += rnd(distortionX * r);
    pos[1] += rnd(distortionY * r); 
    
    if (i === 0) turtle.jump(pos);
    else turtle.goto(pos);
    
    return i < (grid ** 2) + grid - 1;
}