]> git.cworth.org Git - zombocom-ai/blobdiff - bus.html
Add some convenience functions with implicit cairo context
[zombocom-ai] / bus.html
index 214174cca0d57069b2991fde27ec3425d795682c..df6f572ed27ca18708d1aea16b2a3d89819601b9 100644 (file)
--- a/bus.html
+++ b/bus.html
        Magic School Bus Central Processor
       </h1>
       <form id="form">
-       <textarea id="code" rows="10" width="100%">cr.move_to(10,10);
-cr.line_to(100, 100);
-cr.set_line_width(6);
-cr.stroke();</textarea>
+       <textarea id="code" rows="10" width="100%">def random_dot():
+  x = 512 * random()
+  y = 512 * random()
+  radius = 4 + 6 * random()
+  circle(x, y, radius);
+  fill();
+
+for i in range(1000):
+  if i %2 == 0:
+    set_color('red')
+  else:
+    set_color('blue')
+  random_dot();</textarea>
        <button type="submit">Run code</button>
       </form>
       <img id="output"></img>
@@ -169,7 +178,6 @@ cr.stroke();</textarea>
 
     form.addEventListener('submit', event => {
        event.preventDefault();
-       console.log("Submitted form with code: " + code.value);
        socket.emit('run', code.value);
     });