fixed Animitation shoot
This commit is contained in:
parent
c2be377a92
commit
3f3afef40d
@ -141,7 +141,10 @@ ellipse{
|
|||||||
100%{top: var(--top325)}
|
100%{top: var(--top325)}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@-webkit-keyframes Shoot{
|
||||||
|
0%{top: var(--top)}
|
||||||
|
100%{top: var(--top325)}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -60,6 +60,7 @@ Board.prototype.enableTurn = function() {
|
|||||||
cup.setAttribute('active', 'true');
|
cup.setAttribute('active', 'true');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
ball.classList.remove("Shoot");
|
||||||
};
|
};
|
||||||
|
|
||||||
Board.prototype.highlightcups = function() {
|
Board.prototype.highlightcups = function() {
|
||||||
@ -79,88 +80,110 @@ Board.prototype.lowlightcups = function() {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Board.prototype.shoot = function(cup) {
|
||||||
|
ball.classList.add("Shoot");
|
||||||
|
switch(cup) {
|
||||||
|
case 0:
|
||||||
|
root.style.setProperty('--top325', "-515"+ "px");
|
||||||
|
ball.style.top = "-515px";
|
||||||
|
ball.style.left = "-155px";
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
root.style.setProperty('--top325', "-515"+ "px");
|
||||||
|
ball.style.top = "-515px";
|
||||||
|
ball.style.left = "-50px";
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
root.style.setProperty('--top325', "-515"+ "px");
|
||||||
|
ball.style.top = "-515px";
|
||||||
|
ball.style.left = "50px";
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
root.style.setProperty('--top325', "-515"+ "px");
|
||||||
|
ball.style.top = "-515px";
|
||||||
|
ball.style.left = "150px";
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
root.style.setProperty('--top325', "-430"+ "px");
|
||||||
|
ball.style.top = "-430px";
|
||||||
|
ball.style.left = "-100px";
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
root.style.setProperty('--top325', "-430"+ "px");
|
||||||
|
ball.style.top = "-430px";
|
||||||
|
ball.style.left = "0px";
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
root.style.setProperty('--top325', "-430"+ "px");
|
||||||
|
ball.style.top = "-430px";
|
||||||
|
ball.style.left = "100px";
|
||||||
|
break;
|
||||||
|
case 7:
|
||||||
|
root.style.setProperty('--top325', "-340"+ "px");
|
||||||
|
ball.style.top = "-340px"
|
||||||
|
ball.style.left = "-50px";
|
||||||
|
break;
|
||||||
|
case 8:
|
||||||
|
root.style.setProperty('--top325', "-340"+ "px");
|
||||||
|
ball.style.top = "-340px"
|
||||||
|
ball.style.left = "50px";
|
||||||
|
break;
|
||||||
|
case 9:
|
||||||
|
root.style.setProperty('--top325', "-250"+ "px");
|
||||||
|
ball.style.top = "-250px"
|
||||||
|
ball.style.left = "0px";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Board.prototype.getCup = function(code) {
|
Board.prototype.getCup = function(code) {
|
||||||
ball.classList.add("Shoot");
|
|
||||||
switch (code)
|
switch (code)
|
||||||
{
|
{
|
||||||
case 'q':
|
case 'q':
|
||||||
case 'Q':
|
case 'Q':
|
||||||
root.style.setProperty('--top325', "-515"+ "px");
|
|
||||||
ball.style.top = "-515px";
|
|
||||||
ball.style.left = "-155px";
|
|
||||||
return "cup1";
|
return "cup1";
|
||||||
break;
|
break;
|
||||||
case 'w':
|
case 'w':
|
||||||
case 'W':
|
case 'W':
|
||||||
root.style.setProperty('--top325', "-515"+ "px");
|
|
||||||
ball.style.top = "-515px";
|
|
||||||
ball.style.left = "-50px";
|
|
||||||
return "cup2";
|
return "cup2";
|
||||||
//removeCup("2");j
|
|
||||||
break;
|
break;
|
||||||
case 'e':
|
case 'e':
|
||||||
case 'E':
|
case 'E':
|
||||||
root.style.setProperty('--top325', "-515"+ "px");
|
|
||||||
ball.style.top = "-515px";
|
|
||||||
ball.style.left = "50px";
|
|
||||||
return "cup3";
|
return "cup3";
|
||||||
//removeCup("3");
|
|
||||||
break;
|
break;
|
||||||
case 'r':
|
case 'r':
|
||||||
case 'R':
|
case 'R':
|
||||||
root.style.setProperty('--top325', "-515"+ "px");
|
|
||||||
ball.style.top = "-515px";
|
|
||||||
ball.style.left = "150px";
|
|
||||||
return "cup4";
|
return "cup4";
|
||||||
//removeCup("4");
|
|
||||||
break;
|
break;
|
||||||
case 'a':
|
case 'a':
|
||||||
case 'A':
|
case 'A':
|
||||||
root.style.setProperty('--top325', "-430"+ "px");
|
|
||||||
ball.style.top = "-430px";
|
|
||||||
ball.style.left = "-100px";
|
|
||||||
return "cup5";
|
return "cup5";
|
||||||
//removeCup("5");
|
|
||||||
break;
|
break;
|
||||||
case 's':
|
case 's':
|
||||||
case 'S':
|
case 'S':
|
||||||
root.style.setProperty('--top325', "-430"+ "px");
|
|
||||||
ball.style.top = "-430px";
|
|
||||||
ball.style.left = "0px";
|
|
||||||
return "cup6";
|
return "cup6";
|
||||||
//removeCup("6");
|
|
||||||
break;
|
break;
|
||||||
case 'd':
|
case 'd':
|
||||||
case 'D':
|
case 'D':
|
||||||
root.style.setProperty('--top325', "-430"+ "px");
|
|
||||||
ball.style.top = "-430px";
|
|
||||||
ball.style.left = "100px";
|
|
||||||
//removeCup("7");
|
|
||||||
return "cup7";
|
return "cup7";
|
||||||
break;
|
break;
|
||||||
case 'y':
|
case 'y':
|
||||||
case 'Y':
|
case 'Y':
|
||||||
root.style.setProperty('--top325', "-340"+ "px");
|
|
||||||
ball.style.top = "-340px"
|
|
||||||
ball.style.left = "-50px";
|
|
||||||
//removeCup("8");
|
|
||||||
return "cup8";
|
return "cup8";
|
||||||
break;
|
break;
|
||||||
case 'x':
|
case 'x':
|
||||||
case 'X':
|
case 'X':
|
||||||
root.style.setProperty('--top325', "-340"+ "px");
|
|
||||||
ball.style.top = "-340px"
|
|
||||||
ball.style.left = "50px";
|
|
||||||
//removeCup("9");
|
|
||||||
return "cup9";
|
return "cup9";
|
||||||
break;
|
break;
|
||||||
case 'c':
|
case 'c':
|
||||||
case 'C':
|
case 'C':
|
||||||
root.style.setProperty('--top325', "-250"+ "px");
|
|
||||||
ball.style.top = "-250px"
|
|
||||||
ball.style.left = "0px";
|
|
||||||
//removeCup("10");
|
|
||||||
return "cup10";
|
return "cup10";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -174,6 +197,7 @@ Board.prototype.getCup = function(code) {
|
|||||||
*/
|
*/
|
||||||
Board.prototype.mark = function(event) {
|
Board.prototype.mark = function(event) {
|
||||||
if (this.ready) {
|
if (this.ready) {
|
||||||
|
|
||||||
var target = document.getElementById(this.getCup(event.key));
|
var target = document.getElementById(this.getCup(event.key));
|
||||||
if (target.getAttribute('data-intent') === 'gamecup' && target.getAttribute('active') === 'true') {
|
if (target.getAttribute('data-intent') === 'gamecup' && target.getAttribute('active') === 'true') {
|
||||||
this.onMark(this.cups.indexOf(target));
|
this.onMark(this.cups.indexOf(target));
|
||||||
@ -192,13 +216,15 @@ Board.prototype.doMark = function(cupId, label) {
|
|||||||
var cup = this.cups[cupId];
|
var cup = this.cups[cupId];
|
||||||
cup.textContent = label;
|
cup.textContent = label;
|
||||||
//cup.classList.add('notActive');
|
//cup.classList.add('notActive');
|
||||||
// removeCup
|
// removeCup
|
||||||
|
if(cup.getAttribute('marked') === 'false') this.shoot(cupId);
|
||||||
setTimeout(this.cups[cupId].classList.add("fadeAway") ,1000);
|
setTimeout(this.cups[cupId].classList.add("fadeAway") ,1000);
|
||||||
cup.setAttribute('marked', 'true');
|
cup.setAttribute('marked', 'true');
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
ball.style.top = "0px";
|
ball.style.top = "0px";
|
||||||
ball.style.left = "0px";
|
ball.style.left = "0px";
|
||||||
}, 1000);
|
}, 1000);
|
||||||
|
this.currentTurn = (this.currentTurn + 1) % 2;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
var socket = new WebSocket('ws://192.168.188.72:2667');
|
var socket = new WebSocket('ws://localhost:2667');
|
||||||
var events = {
|
var events = {
|
||||||
outgoing: {
|
outgoing: {
|
||||||
JOIN_GAME: 'csJoinGame',
|
JOIN_GAME: 'csJoinGame',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user