rc-web@6: var socket = io.connect(); rc-web@5: rc-web@5: //socket.on("metroPulse", metronomeTick); rc-web@6: ///////////////////////////////////////////////// rc-web@6: socket.on("metroPulse", pulseInClient); rc-web@6: function pulseInClient(pulse,groupID,metrobeat){ rc-web@6: var groupPage=document.getElementById('group').value rc-web@6: if (groupID == groupPage) { rc-web@6: metronomeTick(1000, groupID, metrobeat); rc-web@6: } rc-web@6: } rc-web@6: ///////////////////////////////////////////////// rc-web@5: function metroCss(beat, beatcolor,text){ rc-web@5: var color = beatcolor; rc-web@5: rc-web@5: $(".metrocase > div").each(function(){$(this).stop()}); rc-web@5: $(".metrocase > div").each(function(){$(this).css('background-color', beatcolor)}); rc-web@5: $(".metrocase > div").each(function(){$(this).text(" ")}); rc-web@5: $(".metrocase > div").each(function(){$(this).animate({opacity: 0.5}, rc-web@5: 50, rc-web@5: function() { $(this).animate({opacity:0.0}); } rc-web@5: ); rc-web@5: }) rc-web@5: } rc-web@5: rc-web@5: rc-web@5: rc-web@5: function metronomeTick(pulse, voice,metrobeat) { rc-web@5: console.log( voice+ " metronome tick" + metrobeat) rc-web@5: var color = "gray" rc-web@5: rc-web@5: metroCss(0, "red", "4") rc-web@5: rc-web@5: //if (metrobeat == 0) { rc-web@5: // metroCss(0, "gray", "1") rc-web@5: // } rc-web@5: rc-web@5: //if (metrobeat == 3) { rc-web@5: // metroCss(0, "white", "4") rc-web@5: // } rc-web@5: rc-web@5: // if (metrobeat == 1||metrobeat == 2){ rc-web@5: // $("#metronome"+metrobeat).stop(); rc-web@5: // $("#metronome"+metrobeat).css('background-color', color); rc-web@5: // $("#metronome"+metrobeat).text(" "); rc-web@5: //$("#metronome"+metrobeat).text(metrobeat+1); rc-web@5: // $("#metronome"+metrobeat).animate({opacity: 1}, rc-web@5: // 50, rc-web@5: // function() { $(this).animate({opacity:0.0}); } rc-web@5: // ); rc-web@5: // } rc-web@5: };