Merge branch 'gh-pages' of http://github.com/teamsnowman/hextris into gh-pages

This commit is contained in:
garrettdreyfus 2014-05-26 12:53:08 -04:00
commit 4d1aadd8d7
2 changed files with 23 additions and 0 deletions

View file

@ -151,3 +151,25 @@ function Block(fallingLane, color, iter, distFromHex, settled) {
ctx.globalAlpha = 1;
};
}
function findCenterOfBlocks(arr) {
var avgDFH = 0;
var avgAngle = 0;
for (var i = 0; i < arr.length; i++) {
avgDFH += arr[i].distFromHex;
while (arr[i].angle < 0) {
arr[i].angle += 360;
}
avgAngle += arr[i].angle % 360;
}
avgDFH /= arr.length;
avgAngle /= arr.length;
return {
x:trueCanvas.width/2 + Math.cos(avgAngle * (Math.PI / 180)) * avgDFH,
y:trueCanvas.height/2 + Math.sin(avgAngle * (Math.PI / 180)) * avgDFH
}
}

View file

@ -150,6 +150,7 @@ function Clock(sideLength) {
else {
this.angle += this.angularVelocity;
}
drawPolygon(this.x + gdx, this.y + gdy + this.dy, this.sides, this.sideLength, this.angle, this.fillColor, 0, 'rgba(0,0,0,0)');
};
}