slow-forming with straight lines

Slow forming straight-line only shapes
based on turtletoy.net/turtle/eed0f57234
and stackoverflow.com/questions/951021/what-is-the-javascript-version-of-sleep

Log in to post a comment.

//based on https://turtletoy.net/turtle/eed0f57234
// You can find the Turtle API reference here: https://turtletoy.net/syntax
Canvas.setpenopacity(1);

// Global code will be evaluated once.
const turtle = new Turtle();
turtle.penup();
turtle.goto(0,0);
turtle.pendown();

function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
function pausecomp(millis)
{
  var date = new Date();
  var curDate = null;
  do { curDate = new Date(); }
  while(curDate-date < millis);
}
// The walk function will be called until it returns false.
function walk(i) {
  turtle.forward(i/5); //mess with this for tighter or looser shapes
  turtle.right(110); //mess with this to obtain other shapes
  //await sleep(100); //await not valid inside the walk function
  pausecomp(10);
  return i < 2500;
}