git @ Cat's Eye Technologies Erratic-Turtle-Graphics / 52a594b
Fix initially selected program. Chris Pressey 5 years ago
1 changed file(s) with 20 addition(s) and 19 deletion(s). Raw diff Collapse all Expand all
99 config.container.appendChild(can);
1010
1111 var turtle = (new ErraticTurtle()).init({ canvas: can });
12 var program = "seterr 0 0 setxyp 0.125 0.5 lt 90 repeat 7 [ repeat 50 [ fd 150 lt 180 ] shiftxyp 0.125 0.0 shifterr 0.01 2.0 ]";
12 var options = [
13 {
14 text: 'Lines',
15 value: "seterr 0 0 setxyp 0.125 0.666 lt 90 repeat 7 [ repeat 50 [ fd 150 lt 180 ] shiftxyp 0.125 0.0 shifterr 0.00375 0.3 ]"
16 },
17 {
18 text: 'Boxes',
19 value: "seterr 0 0 setxyp 0.125 0.666 lt 90 repeat 7 [ repeat 400 [ fd 50 lt 90 ] shiftxyp 0.125 0.0 shifterr 0.0015 0.3 ]"
20 },
21 {
22 text: 'Circles',
23 value: "seterr 0 0 setxyp 0.125 0.5 lt 90 repeat 7 [ repeat 4500 [ fd 1.0 lt 4 ] shiftxyp 0.125 0.0 shifterr 0.00375 0.05 ]"
24 },
25 {
26 text: 'Circle Chain',
27 value: "seterr 0 0 setxyp 1.0 0.5 lt 90 repeat 7 [ repeat 1845 [ fd 2.0 lt 4 ] lt 180 shifterr 0.00375 0.225 ] repeat 7 [ repeat 1845 [ fd 2.0 lt 4 ] lt 180 shifterr -0.00375 -0.225 ]"
28 }
29 ];
30 var program = options[0].value;
1331
1432 function run() {
1533 turtle.reset();
2543 div(
2644 DAM.makeSelect({
2745 title: "Form",
28 options: [
29 {
30 text: 'Lines',
31 value: "seterr 0 0 setxyp 0.125 0.666 lt 90 repeat 7 [ repeat 50 [ fd 150 lt 180 ] shiftxyp 0.125 0.0 shifterr 0.00375 0.3 ]"
32 },
33 {
34 text: 'Boxes',
35 value: "seterr 0 0 setxyp 0.125 0.666 lt 90 repeat 7 [ repeat 400 [ fd 50 lt 90 ] shiftxyp 0.125 0.0 shifterr 0.0015 0.3 ]"
36 },
37 {
38 text: 'Circles',
39 value: "seterr 0 0 setxyp 0.125 0.5 lt 90 repeat 7 [ repeat 4500 [ fd 1.0 lt 4 ] shiftxyp 0.125 0.0 shifterr 0.00375 0.05 ]"
40 },
41 {
42 text: 'Circle Chain',
43 value: "seterr 0 0 setxyp 1.0 0.5 lt 90 repeat 7 [ repeat 1845 [ fd 2.0 lt 4 ] lt 180 shifterr 0.00375 0.225 ] repeat 7 [ repeat 1845 [ fd 2.0 lt 4 ] lt 180 shifterr -0.00375 -0.225 ]"
44 }
45 ],
46 options: options,
4647 onchange: function(option) {
4748 program = option.value;
4849 run();