4 ms·
I have seen this site some days ago (reddit maybe?) and I really like the concept! The design is very clean! One feature I'd like: A way to slow down the rende
by antoineMoPa 8y ago
I have seen this site some days ago (reddit maybe?) and I really like the concept! The design is very clean!
One feature I'd like: A way to slow down the render so we can see the whole generation in slow-motion.
- msurguy 8y ago+1
- keithxm23 8y agoAnd once you can slow down the generation, it would also be lovely to highlight the line of code being executed as the picture was drawn!
- gabriel34 8y agowell, it is javascript, so you could implement something like https://stackoverflow.com/questions/951021/what-is-the-javascript-version-of-sleep https://stackoverflow.com/questions/951021/what-is-the-javas... the async way doesn't seem to work inside the walk function, but the older (and uglier imo) way does As an example here is the modified code for https://turtletoy.net/turtle/eed0f57234 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); turtle.right(150); //await sleep(100); //await not valid inside the walk function pausecomp(50) return i < 200; } edit: implemented: https://turtletoy.net/turtle/e99ca811ad https://turtletoy.net/turtle/e99ca811ad