git @ Cat's Eye Technologies Kolakoski-Kurve / f3a245b
Initialize properly and otherwise clean up gewgaw implementation. Chris Pressey 3 years ago
1 changed file(s) with 6 addition(s) and 7 deletion(s). Raw diff Collapse all Expand all
66 this.ctx.strokeStyle = "black";
77 this.ctx.globalCompositeOperation = 'source-over';
88 this.dist = 5;
9 this.deltaTheta = 90;
10 this.setStyle('opaque');
911
1012 this.startIndex = 0;
1113 this.endIndex = 10000;
3133 }
3234 var $this = this;
3335 var stepFunction = function() {
34 $this.step();
36 $this.draw();
3537 setTimeout(stepFunction, 0);
3638 }
3739 this.intervalID = setTimeout(stepFunction, 0);
4345 var num = this.sequence[this.index];
4446
4547 if (num === 1) {
46 // FD 10
48 // Go forward
4749 var rad = (this.theta / 360) * (Math.PI * 2);
4850
4951 var dx = this.dist * Math.cos(rad);
6062 this.x = newX;
6163 this.y = newY;
6264 } else if (num === 2) {
63 // RT 90
64 this.theta += 90;
65 // Turn right
66 this.theta += this.deltaTheta;
6567 while (this.theta >= 360) this.theta -= 360;
6668 } else {
6769 alert('wtf');
8183 for (var j = 0; j < this.stepSize; j++) {
8284 this.step();
8385 }
84 };
85
86 this.update = function() {
8786 };
8887
8988 /*