JSFiddle - React, Tailwind, and code Playground
HTML
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="//code.jquery.com/ui/1.10.4/jquery-ui.js"></script>
<link rel="stylesheet" href="//code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css">
<div class="bgplay">
<div class="nota_vermelha_cair"></div>
<div class="nota_roxa_cair"></div>
<div class="nota_verde_cair"></div>
<div class="nota_azul_cair"></div>
<div class="nota_amarela_cair"></div>
<div id="fim" style="position: absolute; display: none;"></div>
<button id="comecar" onclick="newgame()">Comecar
</button>
<div class="teclas">
<ul>
<li class="nota_amarela">1</li>
<li class="nota_azul">2</li>
<li class="nota_verde">3</li>
<li class="nota_roxa">4</li>
<li class="nota_vermelha">5</li>
</ul>
</div>
</div>
<div id="progressbar" style="width: 1000px !important; height: 5px;
margin-left: 10px; margin-right: 10px;"><div class="progress-label"></div></div>
CSS
body {
padding: 0px;
margin: 0px;
text-align: center;
font-family: Arial, sans-serif;
font-size: 14px;
background-color: darkgray;
}
.bgplay {
width: 1000px;
height: 400px;
background-color: darkgray;
margin-left: auto;
margin-right: auto;
border: darkgray 1px solid;
opacity: 0.8;
-webkit-border-radius: none;
-moz-border-radius: none;
border-radius: 0px;
}
.ui-progressbar {
position: relative;
}
.progress-label {
position: absolute;
left: 50%;
top: 4px;
font-weight: bold;
text-shadow: 1px 1px 0 #fff;
color: darkgray;
}
.teclas {
color: white;
font-size: 21px;
width: 250px;
height: 40px;
display: inline;
float: left;
margin-top: 342px;
margin-left: 284px;
}
.teclas li {
float: left;
list-style-type: none;
}
#comecar {
cursor: pointer;
float: left;
width: 73px;
height: 26px;
}
.nota_azul {
background-color: transparent;
width: 28px;
height: 28px;
border-radius: 50%;
-moz-border-radius: 50%;
-webkit-border-radius: 50%;
border: 2px #0B6969 solid;
margin-left: 10px;
}
.nota_amarela {
background-color: transparent;
width: 28px;
height: 28px;
border-radius: 50%;
-moz-border-radius: 50%;
-webkit-border-radius: 50%;
border: 2px #969600 solid;
margin-left: 18px;
}
.nota_verde {
background-color: transparent;
width: 28px;
height: 28px;
border-radius: 50%;
-moz-border-radius: 50%;
-webkit-border-radius: 50%;
border: 2px #18A400 solid;
margin-left: 7px;
}
.nota_roxa {
background-color: transparent;
width: 28px;
height: 28px;
border-radius: 50%;
-moz-border-radius: 50%;
-webkit-border-radius: 50%;
border: 2px #AC00AC solid;
margin-left: 7px;
}
.nota_vermelha {
background-color: transparent;
width: 28px;
height: 28px;
border-radius: 50%;
-moz-border-radius: 50%;
...
JavaScript
var acertos;
var inicio;
var fim = 455;
var valorAtual;
function newgame(){
$("#comecar").hide();
$("div.teclas").css("margin-right", "393px");
$("div.teclas").css("float", "right");
$("div.bgplay").css("opacity", "1.0");
hover();
verde();
function verde() {
inicio;
acertos = 0;
function testarAcerto(e) {
if (e.which == 51 && Math.round(valorAtual) > 0) {
$('.nota_verde_cair').remove();
acertos++;
$(document).bind("keyup");
}
}
$(".nota_verde_cair").fadeTo( 500, 1 );
$(document).bind("keyup");
$('.nota_verde_cair').animate({
top: fim + "px"
}, {
duration: 6000,
start: function () {
inicio = window.getComputedStyle(this).top.replace('px', '');
$(document).bind("keyup", testarAcerto);
},
progress: function (a, p, r) {
valorAtual = p * (fim - inicio);
$(document).bind("keyup");
},
complete: function (verde) {
$('.nota_verde_cair').remove();
$(document).unbind("keyup");
}
});
}
function hover() {
$(document).keydown(function(e) {
if(e.which == 49) {
$('li.nota_amarela').css('border', '2px black solid');
}
});
$(document).keyup(function(e) {
if(e.which == 49) {
$('li.nota_amarela').css('border', '2px #969600 solid');
}
});
$(document).keydown(function(e) {
if(e.which == 50) {
$('li.nota_azul').css('border', '2px black solid');
}
});
$(document).keyup(function(e) {
if(e.which == 50) {
$('li.nota_azul').css('border', '2px #0B6969 solid');
}
});
$(document).keydown(function(e) {
if(e.which == 51) {
$('li.nota_verde').css('border', '2px black solid');
}
});
$(document).keyup(function(e) {
if(e.which == 51) {
$('li.nota_verde').css('border', '2px #18A400 solid');
}
});
$(document).keydown(function(e) {
...