Stiffy
Log in to post a comment.
Canvas.setpenopacity(1); const size = 80; const perlinSize = 4; const turtle = new Turtle(); turtle.penup(); turtle.goto(-50, -20); turtle.pendown(); class Perlin { constructor(size, gridSize) { this.size = size; this.gridSize = gridSize; this.grid = []; for (let i = 0; i <= gridSize; i++) { let table = []; for (let j = 0; j <= gridSize; j++) { let angle = Math.random() * 2 * Math.PI; let x = Math.cos(angle); let y = Math.sin(angle); table.push([x, y]); } this.grid.push(table); } } get(x, y) { x = x / 3 + this.size / 2; y = y / 1.5 + this.size / 2; // TODO: Implement interpolation return Math.sin(x) * Math.cos(y); // placeholder } } let perlin = new Perlin(size, perlinSize); function walk(i) { turtle.forward(100); turtle.right(144); turtle.left(10); return i < 100; // run more steps }