fixed block initialization animation playing during pause
This commit is contained in:
parent
1ebf854153
commit
0f27875b33
2 changed files with 6 additions and 6 deletions
|
@ -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 {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue