Log in to post a comment.

// 

const t = new Turtle();
const x0 = -50;
const y0 = -119 // min=-200 max=0 step=1;
const stippleSize = 0.77 // min=0.1 max=2 step=0.01;
const density = 0.59 // min=0.001 max=1 step=0.001;
const noise = 4.02 // min=0.001 max=10 step=0.1;
const size = 26 // min=1 max=50 step=1;
const type = 1 // min=1 max=4 step=1;

// Each pixel has a density chance of getting a dot.

for (let rowY = 0; rowY < size * 8; rowY = rowY + size ){
    for (let y = 0; y < size; y++) {
        for (let x = 0; x < size; x++) {
            if (Math.random() < 0.01 * rowY * density) {
                
            switch (type) {
                case 1:
                    centeredCircle(x0 + x, y0 + y + rowY, stippleSize );
                break;

                case 2:
                    Square(x0 + x, y0 + y + rowY, stippleSize * 2 );
                break;
            
                case 3:
                    Tirangle(x0 + x, y0 + y + rowY, stippleSize * 2 );
                break;
                
                case 4:
                    centeredCircle(x0 + x, y0 + y + rowY, stippleSize );

                    Square(x0 + x, y0 + y + rowY, stippleSize * 2 );
                break;

                default:
                    centeredCircle(x0 + x, y0 + y + rowY, stippleSize );

                }
            }
        }
    }

}

function centeredCircle(x,y,radius) {
    t.jump(x + Math.random() * noise, y-radius + Math.random() * noise);
    t.circle(radius);
}

function Square(x,y,side) {
    t.jump(x -side/2 + Math.random() * noise, y -side/2 + Math.random() * noise);

    for (let n=0; n < 4; n++) {
        t.forward(side);
        t.right(90);
    
    }
}

function Tirangle(x,y,side) {
    t.jump(x + Math.random() * noise,y + Math.random() * noise);

if (x % 2 === 0) {
    t.setheading(0)
  } else {
    t.setheading(180)
  }

    for (let n=0; n < 3; n++) {
        t.forward(side);
        t.right(120);
    }
}