Anyone who is good at see logic traps in programming? comp.lang.javascript is defunct so i try here.
Using the metronome. https://midisequenser.000webhostapp.com I've tried to understand how following code can lead to that after the keyreleased the front of the keyed scrollbar raise/extend faster while the backend stay correct "in sync". One could think/imagine xFrontStart=scrollBarPos-FRONTOFFSET; somehow executed more then once after release, but how could it, the keyrelease is true only in that part of code and only done once??? var FRONTOFFSET=0; var xKeylength=0; var xFrontStart=0; var xBackEnd=0; var keyreleased=false; function pianoSCROLL(){ if(mess.data[0]==NOTE_ON && keyreleased==false){ xBackEnd=keylength; ctm.fillStyle = "magenta"; ctm.fillRect(xBackEnd,(PistartX+keyHeight*88)-(keyHeight*(mess.data[1]-8)), xFrontStart, keyHeight); if(FRONTOFFSET==0) {FRONTOFFSET=scrollBarPos;} xFrontStart=scrollBarPos-FRONTOFFSET; } else if(mess.data[0]==NOTE_OFF && keyreleased==false){ console.log("keyreleased!"); keyreleased=true; xBarLength=Math.round(xFrontStart-xBackEnd); ctm.fillStyle = "black"; ctm.fillRect(keylength, (PistartX+keyHeight*88)-(keyHeight*(mess.data[1]-8)), Mwidth, keyHeight+2); } if (keyreleased) { //console.log("timebar backend moving"); ctm.fillStyle = "black"; ctm.fillRect(keylength, (PistartX+keyHeight*88)-(keyHeight*(mess.data[1]-8)), Mwidth, keyHeight+2); ctm.fillStyle = "orange"; ctm.fillRect(xBackEnd,(PistartX+keyHeight*88)-(keyHeight*(mess.data[1]-8)),xFrontStart, keyHeight); xFrontStart=scrollBarPos-FRONTOFFSET; xBackEnd=Math.round(xFrontStart-xBarLength); console.log("xBackEnd="+xBackEnd+" xBarLength="+xBarLength+" xFrontStart="+xFrontStart); } } -- https://mail.python.org/mailman/listinfo/python-list