Line Wraps around now
This commit is contained in:
parent
8a78a4e6c5
commit
4b434de3ef
2 changed files with 17 additions and 26 deletions
|
@ -1,23 +1,14 @@
|
|||
function drawTimer(){
|
||||
if(MainClock.ct - MainClock.lastCombo < settings.comboMultiplier){
|
||||
var third = settings.comboMultiplier/3;
|
||||
if(settings.comboMultiplier -(MainClock.ct-MainClock.lastCombo)>(third*2)) {
|
||||
var done = ((settings.comboMultiplier -(MainClock.ct-MainClock.lastCombo))%(third*2))/(third*2);
|
||||
drawSide(4,5,1);
|
||||
drawSide(5,0,done);
|
||||
drawSide(1,0,1);
|
||||
drawSide(0,5,done);
|
||||
drawSide(1,2,1);
|
||||
drawSide(2,3,done);
|
||||
drawSide(4,3,1);
|
||||
drawSide(3,2,done);
|
||||
}
|
||||
else{
|
||||
var done = (settings.comboMultiplier -(MainClock.ct-MainClock.lastCombo))/(third*2);
|
||||
drawSide(1,0,done);
|
||||
drawSide(1,2,done);
|
||||
drawSide(4,3,done);
|
||||
drawSide(4,5,done);
|
||||
for(var i=0;i<6;i++){
|
||||
var done = (MainClock.ct -MainClock.lastCombo);
|
||||
if(done>=(settings.comboMultiplier)*(i+1)*(1/6)){
|
||||
drawSide(i,i+1,1);
|
||||
}
|
||||
else{
|
||||
drawSide(i,i+1,((done*6)/settings.comboMultiplier)%(1));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -30,14 +21,14 @@ function drawSide(startVertex,endVertex,fraction){
|
|||
ctx.lineCap = "round"
|
||||
ctx.strokeStyle=MainClock.lastColorScored;
|
||||
ctx.lineWidth =4;
|
||||
var radius = (settings.rows * settings.blockHeight) * (2/Math.sqrt(3)) + settings.hexWidth;
|
||||
var radius = (settings.rows * settings.blockHeight) * (2/Math.sqrt(3)) + settings.hexWidth + 2;
|
||||
var halfRadius = radius/2;
|
||||
var triHeight = radius *(Math.sqrt(3)/2);
|
||||
var hexagonPoints =[[halfRadius,triHeight],[radius,0],[halfRadius,-triHeight],[-halfRadius,-triHeight],[-radius,0],[-halfRadius,triHeight]].reverse();
|
||||
var startX =trueCanvas.width/2 + hexagonPoints[startVertex][0];
|
||||
var startY =trueCanvas.height/2 + hexagonPoints[startVertex][1];
|
||||
var endX = trueCanvas.width/2 + hexagonPoints[endVertex][0];
|
||||
var endY = trueCanvas.height/2 + hexagonPoints[endVertex][1];
|
||||
var Vertexes =[[halfRadius,triHeight],[radius,0],[halfRadius,-triHeight],[-halfRadius,-triHeight],[-radius,0],[-halfRadius,triHeight]].reverse();
|
||||
var startX =trueCanvas.width/2 + Vertexes[startVertex][0];
|
||||
var startY =trueCanvas.height/2 + Vertexes[startVertex][1];
|
||||
var endX = trueCanvas.width/2 + Vertexes[endVertex][0];
|
||||
var endY = trueCanvas.height/2 + Vertexes[endVertex][1];
|
||||
ctx.moveTo(startX,startY);
|
||||
ctx.lineTo(((endX-startX)*fraction)+startX,((endY-startY)*fraction)+startY);
|
||||
ctx.closePath()
|
||||
|
|
|
@ -231,7 +231,7 @@ function importHistory(j) {
|
|||
try {
|
||||
var ih = JSON.parse(prompt("Import JSON"));
|
||||
if (ih) {
|
||||
init();
|
||||
init(1);
|
||||
importing = 1;
|
||||
importedHistory = ih;
|
||||
}
|
||||
|
@ -240,7 +240,7 @@ function importHistory(j) {
|
|||
alert("Error importing JSON");
|
||||
}
|
||||
} else {
|
||||
init();
|
||||
init(1);
|
||||
importing = 1;
|
||||
importedHistory = j;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue