77 | 77 |
this.x = nx;
|
78 | 78 |
this.y = ny;
|
79 | 79 |
};
|
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 | |
};
|
163 | 80 |
};
|