2014-06-24 14:53:26 +00:00
|
|
|
function drawTimer(){
|
|
|
|
if(MainClock.ct - MainClock.lastCombo < settings.comboMultiplier){
|
2014-06-24 15:44:40 +00:00
|
|
|
for(var i=0;i<6;i++){
|
|
|
|
var done = (MainClock.ct -MainClock.lastCombo);
|
2014-06-24 17:22:47 +00:00
|
|
|
if(done<(settings.comboMultiplier)*(5-i)*(1/6)){
|
2014-06-30 16:13:21 +00:00
|
|
|
drawSide(i,i+1,1,1);
|
2014-07-01 01:31:54 +00:00
|
|
|
drawSide(12-i,11-i,1,1);
|
2014-06-24 15:44:40 +00:00
|
|
|
}
|
|
|
|
else{
|
2014-06-30 16:13:21 +00:00
|
|
|
drawSide(i,i+1,1-((done*6)/settings.comboMultiplier)%(1),1);
|
2014-07-01 01:31:54 +00:00
|
|
|
drawSide(12-i,11-i,1-((done*6)/settings.comboMultiplier)%(1),1);
|
2014-06-24 15:44:40 +00:00
|
|
|
break;
|
|
|
|
}
|
2014-06-24 14:53:26 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-06-30 16:13:21 +00:00
|
|
|
function drawSide(startVertex,endVertex,fraction,offset){
|
|
|
|
startVertex = (startVertex+offset)%12;
|
|
|
|
endVertex = (endVertex+offset)%12;
|
2014-06-24 14:53:26 +00:00
|
|
|
ctx.globalAlpha=1;
|
|
|
|
ctx.beginPath();
|
2014-06-28 02:09:36 +00:00
|
|
|
ctx.lineCap = "round";
|
|
|
|
if (gameState === 0) {
|
|
|
|
ctx.strokeStyle = hexColorsToTintedColors[MainClock.lastColorScored];
|
|
|
|
} else {
|
|
|
|
ctx.strokeStyle = MainClock.lastColorScored;
|
|
|
|
}
|
2014-06-24 14:53:26 +00:00
|
|
|
ctx.lineWidth =4;
|
2014-06-24 15:44:40 +00:00
|
|
|
var radius = (settings.rows * settings.blockHeight) * (2/Math.sqrt(3)) + settings.hexWidth + 2;
|
2014-06-24 14:53:26 +00:00
|
|
|
var halfRadius = radius/2;
|
|
|
|
var triHeight = radius *(Math.sqrt(3)/2);
|
2014-06-30 16:13:21 +00:00
|
|
|
var Vertexes =[
|
|
|
|
[(halfRadius*3)/2,triHeight/2],
|
|
|
|
[radius,0],
|
|
|
|
[(halfRadius*3)/2,-triHeight/2],
|
|
|
|
[halfRadius,-triHeight],
|
|
|
|
[0,-triHeight],
|
|
|
|
[-halfRadius,-triHeight],
|
|
|
|
[-(halfRadius*3)/2,-triHeight/2],
|
|
|
|
[-radius,0],
|
|
|
|
[-(halfRadius*3)/2,triHeight/2],
|
|
|
|
[-halfRadius,triHeight],
|
|
|
|
[0,triHeight],
|
|
|
|
[halfRadius,triHeight]].reverse();
|
2014-06-28 02:09:36 +00:00
|
|
|
var startX =trueCanvas.width/2 + Vertexes[startVertex][0];
|
|
|
|
var startY =trueCanvas.height/2 + Vertexes[startVertex][1];
|
2014-06-24 15:44:40 +00:00
|
|
|
var endX = trueCanvas.width/2 + Vertexes[endVertex][0];
|
|
|
|
var endY = trueCanvas.height/2 + Vertexes[endVertex][1];
|
2014-06-24 14:53:26 +00:00
|
|
|
ctx.moveTo(startX,startY);
|
|
|
|
ctx.lineTo(((endX-startX)*fraction)+startX,((endY-startY)*fraction)+startY);
|
2014-06-28 02:09:36 +00:00
|
|
|
ctx.closePath();
|
|
|
|
ctx.fill();
|
2014-06-24 14:53:26 +00:00
|
|
|
ctx.stroke();
|
2014-06-30 16:13:21 +00:00
|
|
|
}
|