diff --git a/js/Block.js b/js/Block.js index 1f566b5..e382dc6 100644 --- a/js/Block.js +++ b/js/Block.js @@ -22,7 +22,7 @@ function Block(fallingLane, color, iter, distFromHex, settled) { this.opacity = 1; //boolean for when the block is expanding this.initializing = 1; - this.ct = 0; + this.ict = MainClock.ct; //speed of block this.iter = iter; //number of iterations before starting to drop @@ -92,7 +92,7 @@ function Block(fallingLane, color, iter, distFromHex, settled) { else { this.angle += this.angularVelocity; } - this.ct++; + this.width = 2 * this.distFromHex / Math.sqrt(3); this.widthWide = this.width + this.height + 3; var p1; @@ -100,12 +100,12 @@ function Block(fallingLane, color, iter, distFromHex, settled) { var p3; var p4; if (this.initializing) { - var rat = (this.ct/this.initLen); + var rat = ((MainClock.ct - this.ict)/this.initLen); p1 = rotatePoint((-this.width / 2) * rat, this.height / 2, this.angle); p2 = rotatePoint((this.width / 2) * rat, this.height / 2, this.angle); p3 = rotatePoint((this.widthWide / 2) * rat, -this.height / 2, this.angle); p4 = rotatePoint((-this.widthWide / 2) * rat, -this.height / 2, this.angle); - if (this.ct == this.initLen) { + if ((MainClock.ct - this.ict) == this.initLen) { this.initializing = 0; } } else { diff --git a/js/render.js b/js/render.js index 8826fd6..574a31c 100644 --- a/js/render.js +++ b/js/render.js @@ -89,13 +89,13 @@ function drawKey(key, x, y) { case "right": ctx.font = "20px Fontawesome"; ctx.translate(x + settings.scale * 12.5, y + settings.scale * 27.5); - ctx.scale( settings.scale, settings.scale); + ctx.scale(settings.scale, settings.scale); ctx.fillText(String.fromCharCode("0xf04b"), 0, 0); break; default: ctx.font = "35px Roboto"; - ctx.translate(x + settings.scale * 25 , y + settings.scale * 39.5) + ctx.translate(x + settings.scale * 25 , y + settings.scale * 39.5); ctx.scale(settings.scale, settings.scale); ctx.fillText(key, 0, 0); }