Slow forming straight-line only shapes
based on star with twelve points
and stackoverflow.com/qu…ipt-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; }