git @ Cat's Eye Technologies Erratic-Turtle-Graphics / ba1e920
Initial turtle state simplifies "Logo" programs. Chris Pressey 2 years ago
2 changed file(s) with 6 addition(s) and 6 deletion(s). Raw diff Collapse all Expand all
1212 var options = [
1313 {
1414 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 ]"
15 value: "setxyp 0.125 0.666 repeat 7 [ repeat 50 [ fd 150 lt 180 ] shiftxyp 0.125 0.0 shifterr 0.00375 0.3 ]"
1616 },
1717 {
1818 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 ]"
19 value: "setxyp 0.125 0.666 repeat 7 [ repeat 400 [ fd 50 lt 90 ] shiftxyp 0.125 0.0 shifterr 0.0015 0.3 ]"
2020 },
2121 {
2222 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 ]"
23 value: "setxyp 0.125 0.5 repeat 7 [ repeat 4500 [ fd 1.0 lt 4 ] shiftxyp 0.125 0.0 shifterr 0.00375 0.05 ]"
2424 },
2525 {
2626 text: 'Stars',
27 value: "seterr 0 0 setxyp 0.125 0.666 lt 90 lt 18 repeat 7 [ repeat 500 [ fd 150 lt 144 ] shiftxyp 0.125 0.0 shifterr 0.00375 0.3 ]"
27 value: "setxyp 0.125 0.666 lt 18 repeat 7 [ repeat 500 [ fd 150 lt 144 ] shiftxyp 0.125 0.0 shifterr 0.00375 0.3 ]"
2828 },
2929 {
3030 text: 'Circle Chain',
31 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 ]"
31 value: "setxyp 1.0 0.5 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 ]"
3232 }
3333 ];
3434 var program = options[0].value;
1313
1414 this.x = this.canvas.width / 2;
1515 this.y = this.canvas.height / 2;
16 this.setTheta(0.0);
16 this.setTheta(270 * DEG);
1717 this.ctx.strokeStyle = 'rgba(0,0,0,0.05)';
1818 this.ctx.lineWidth = 1;
1919