// Press CMD + ENTER to run. var points = 5; for (var i=0; i<points; i++) { moveForward(50); turnLeft(1/points); moveForward(50); turnRight(2*(1/points)); }

Source: https://github.com/forresto/turtle-svg
   __   ___   ___________    ________  _____  ________   ____
  / /  / _ | / __/ __/ _ \  /_  __/ / / / _ \/_  __/ /  / __/
 / /__/ __ |_\ \/ _// , _/   / / / /_/ / , _/ / / / /__/ _/  
/____/_/ |_/___/___/_/|_|   /_/  \____/_/|_| /_/ /____/___/  

Welcome to the JS turtle graphics -> SVG generator. 
This will generate an SVG file with one <path> element.
The turtle starts in the middle facing down.
Angles: 0 is down, 1/4 is right, 1/2 is up, 3/4 is left

// Pen (laser, blade) commands
penUp();               // Shortcut u()
penDown();             // d()

// Relative move
moveForward(distance); // f()

// Relative turns
turnRight(angle);      // r()
turnLeft(angle);       // l()

// Absolute turns
turnTo(angle);         // t()

// Angles for turn commands are 0.0 to 1.0
turnRight(1/4);        // Turn right 90º
turnLeft(1/360);       // Turn left 1º

// SVG move (pen not drawing) and line (drawing)
// Relative
moveBy(x, y); 
lineBy(x, y);
// Absolute
moveTo(x, y); 
lineTo(x, y);

// Functions and commands are JS:
var drawRegular = function(sideCount, sideLength) {
  for (var i=0; i<sideCount; i++){
    moveForward(sideLength);
    turnRight(1/sideCount);
  }
};
drawRegular(5, 20);

// Draw a square:
moveForward(100);
turnLeft(1/4);
moveForward(100);
turnLeft(1/4);
moveForward(100);
turnLeft(1/4);
moveForward(100);

// Draw a recursive space-filling curve:
var segmentLength = 15;
function unit(iteration) {
  if (iteration > 0) {
    unit(iteration - 1);
    r(0.25);
    unit(iteration - 1);
    f(segmentLength);
    unit(iteration - 1);
    r(0.25);
    unit(iteration - 1);
  }
}
moveTo(30, 20);
turnTo(3/8);
unit(6);
f(segmentLength);
unit(6);

// Draw golden ratio squares with Phi
var PHI = (1 + Math.sqrt(5)) / 2;
var scale = 300;
var i = 0;
moveTo(20, 20);
while( scale >= 1 ){
  f(scale);
  l(1/4);
  f(scale);
  l(1/4);
  f(scale);
  l(1/4);
  f(scale);
  l(1/4);
  f(scale);
  scale = scale/PHI;
  f(scale);
  l(1/4);
}

// Draw golden ratio squares with Fibonacci
var side = 3;
var lastSide = 0;
var nextSide;
moveTo(550, 350);
while( side < 1200 ){
  // Draw square
  f(side);
  l(1/4);
  f(side);
  l(1/4);
  f(side);
  l(1/4);
  f(side);
  l(1/4);
  f(side);
  l(1/4);
  f(side);
  // Advance fib
  nextSide = side + lastSide;
  lastSide = side;
  side = nextSide;
}