git @ Cat's Eye Technologies Erratic-Turtle-Graphics / f6e54fb
Everything was previously scaled down by 1/7. Match that, switch. Chris Pressey 3 years ago
2 changed file(s) with 4 addition(s) and 87 deletion(s). Raw diff Collapse all Expand all
2828 options: [
2929 {
3030 text: 'Lines',
31 value: "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 ]"
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 ]"
3232 },
3333 {
3434 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.01 2.0 ]"
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 ]"
3636 },
3737 {
3838 text: 'Circles',
39 value: "seterr 0 0 setxyp 0.125 0.666 lt 90 repeat 7 [ repeat 4500 [ fd 1.0 lt 4 ] shiftxyp 0.125 0.0 shifterr 0.025 0.333 ]"
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 ]"
4040 },
4141 {
4242 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.025 1.5 ] repeat 7 [ repeat 1845 [ fd 2.0 lt 4 ] lt 180 shifterr -0.025 -1.5 ]"
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 ]"
4444 }
4545 ],
4646 onchange: function(option) {
7777 this.x = nx;
7878 this.y = ny;
7979 };
80
81 this.drawItems = function(y, drawItem) {
82 this.x = this.canvas.width * (1/8);
83 this.y = y;
84 this.setTheta(-90.0 * DEG);
85
86 for (var i = 0; i < 7; i++) {
87 drawItem(i);
88 this.x += this.canvas.width * (1/8);
89 this.y = y;
90 }
91 };
92
93 this.drawLine = function(size) {
94 for (var i = 0; i < 50; i++) {
95 this.moveBy(size);
96 this.rotateBy(-180.0 * DEG);
97 }
98 };
99
100 this.drawBox = function(size) {
101 for (var i = 0; i < 400; i++) {
102 this.moveBy(size);
103 this.rotateBy(-90.0 * DEG);
104 }
105 };
106
107 this.drawCircle = function(size, reps) {
108 for (var i = 0; i < 90 * reps; i++) {
109 this.moveBy(size);
110 this.rotateBy(-4.0 * DEG);
111 }
112 };
113
114 this.drawLines = function() {
115 var $this = this;
116 this.drawItems(this.canvas.height * (1/2), function(n) {
117 $this.rotateError = 0.01 * (n/7);
118 $this.moveError = 2.0 * (n/7);
119 $this.drawLine(150);
120 });
121 };
122
123 this.drawBoxes = function() {
124 var $this = this;
125 this.drawItems(this.canvas.height * (2/3), function(n) {
126 $this.rotateError = 0.01 * (n/7);
127 $this.moveError = 2.0 * (n/7);
128 $this.drawBox(50);
129 });
130 };
131
132 this.drawCircles = function() {
133 var $this = this;
134 this.drawItems(this.canvas.height * (7/8), function(n) {
135 $this.rotateError = 0.025 * (n/7);
136 $this.moveError = 0.333 * (n/7);
137 $this.drawCircle(1.0, 50);
138 });
139 };
140
141 this.drawCircleChain = function(size) {
142 this.x = this.canvas.width;
143 this.y = this.canvas.height * (1/2);
144 this.setTheta(-90.0 * DEG);
145
146 var SEGS = 7;
147
148 for (var n = 0; n <= SEGS; n++) {
149 this.rotateError = 0.025 * (n/SEGS);
150 this.moveError = 1.5 * (n/SEGS);
151
152 this.drawCircle(2.0, 20.5);
153 this.rotateBy(-180.0 * DEG);
154 }
155 for (var n = SEGS; n >= 0; n--) {
156 this.rotateError = 0.025 * (n/SEGS);
157 this.moveError = 1.5 * (n/SEGS);
158
159 this.drawCircle(2.0, 20.5);
160 this.rotateBy(-180.0 * DEG);
161 }
162 };
16380 };