@@ -29,11 +29,18 @@ <h1><img id="turtle_image" src='data:image/svg+xml,<svg xmlns="http://www.w3.org
29
29
30
30
< div class ="mv-bar " mv-bar ="with import export clear "> </ div >
31
31
< details >
32
- < summary class ="button mv- code-js "> Code (JS)</ summary >
32
+ < summary class ="button code-js "> Code (JS)</ summary >
33
33
< div >
34
34
< textarea > [code_before][code]</ textarea >
35
35
</ div >
36
36
</ details >
37
+ < details >
38
+ < summary class ="button code-logo "> Code (LOGO)</ summary >
39
+ < div >
40
+ < textarea > [logo_code]</ textarea >
41
+ </ div >
42
+ </ details >
43
+
37
44
38
45
< section >
39
46
< input type ="number " property ="width " value ="1000 " /> ×
@@ -63,6 +70,7 @@ <h1><img id="turtle_image" src='data:image/svg+xml,<svg xmlns="http://www.w3.org
63
70
< option value ="1 "> clockwise</ option >
64
71
< option value ="-1 "> anti-clockwise</ option >
65
72
</ select >
73
+ < meta property ="logo " content ="[if(direction = 1, 'right', 'left')] [angle] " />
66
74
< meta property ="js " content ='ctx.rotate((Math.PI / 180) * [direction] * [angle]);
67
75
'>
68
76
</ label >
@@ -74,7 +82,7 @@ <h1><img id="turtle_image" src='data:image/svg+xml,<svg xmlns="http://www.w3.org
74
82
</ select >
75
83
< input type ="number " property ="steps " value ="100 " />
76
84
steps
77
-
85
+ < meta property =" logo " content =" [if(direction = 1, 'forward', 'backward')] [steps] " />
78
86
< meta property ="js " content ='
79
87
ctx.moveTo(0, 0);
80
88
ctx.lineTo([direction] * [steps], 0);
@@ -87,19 +95,25 @@ <h1><img id="turtle_image" src='data:image/svg+xml,<svg xmlns="http://www.w3.org
87
95
to
88
96
<!-- color.$previous should have worked here -->
89
97
< input type ="color " property ="color " mv-default ="[first(condense(color.$all).slice(0, -1)) or '#ff0066'] " />
90
- < meta property ="js " content ='var color = ctx.strokeStyle = "[color]";
98
+ < meta property ="logo " content ="setpc [color] " />
99
+ < meta property ="js " content ='ctx.strokeStyle = "[color]";
91
100
if (brushDown) ctx.closePath(); ctx.beginPath(); '>
92
101
</ label >
93
102
94
103
< div mv-if ="type = 'up' ">
104
+ < meta property ="logo " mv-mode ="read " content ="penup " />
95
105
< meta property ="js " content ='ctx.closePath(); brushDown = false; ' mv-mode ="read ">
96
106
</ div >
97
107
< div mv-if ="type = 'down' ">
108
+ < meta property ="logo " mv-mode ="read " content ="pendown " />
98
109
< meta property ="js " content ='ctx.beginPath(); brushDown = true; ' mv-mode ="read ">
99
110
</ div >
100
111
< label mv-if ="type = 'repeat' ">
101
112
< input type ="number " property ="times " />
102
113
times:
114
+ < meta property ="logo " content ='repeat [times] ["\\u005B"]
115
+ [ replace(join(instruction.logo, "\\n"), "\\n", "\\n\\t") ]
116
+ ["\\u005D"] ' />
103
117
< meta property ="js " content ='for (let i=0; i<[times]; i++) {
104
118
[ replace(join(instruction.js, "\\n"), "\\n", "\\n\\t") ]
105
119
} '>
@@ -112,6 +126,7 @@ <h1><img id="turtle_image" src='data:image/svg+xml,<svg xmlns="http://www.w3.org
112
126
</ li >
113
127
</ ol >
114
128
< meta property ="code " content ="[join(js, '\\n')] " />
129
+ < meta property ="logo_code " content ="[join(logo, '\\n')] " />
115
130
116
131
< footer >
117
132
Concept & design heavily inspired < br > from Nicky Case’s awesome < a href ="http://ncase.me/joy-demo/turtle/ " target ="_blank "> Joy of Turtle</ a >
0 commit comments