Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #36069

Re: Moving pianoscrollbar get wavy

Newsgroups comp.lang.javascript
Date 2019-02-27 13:55 -0800
References <7274cd03-fd2c-4c8c-ab26-a0a16155ad00@googlegroups.com> <15669fef-9029-4690-b99a-30ea76f85c54@googlegroups.com>
Message-ID <5b56daa7-9a77-48a9-9d96-3bcf4e00a8f4@googlegroups.com> (permalink)
Subject Re: Moving pianoscrollbar get wavy
From Jonas Thörnvall <jonas.thornvall@gmail.com>

Show all headers | View raw


Den onsdag 27 februari 2019 kl. 22:36:04 UTC+1 skrev Jonas Thörnvall:
> Den onsdag 27 februari 2019 kl. 21:11:09 UTC+1 skrev Jonas Thörnvall:
> > I started to try get a moving pianoscrollbar working "push record" but i seem to have the wrong values caculated after keyreleased.
> > 
> > The actual calculating function "scrollbar" is another function but this is one i called from that to draw out scrolling pianokeys. All calculations are done from totalmove "that for some reason i pass global". This just a test for one key "i do not read keypresses into array and check for what key is released". So it is just a single stroke attempt to get the logic for a moving bar working. I probably should written the logic on paper because it is slipping here and there. But once this logic work i will save keystrokes to array. So this is live to canvas, for editing i create another function. All the calculations are dependent on the "totalmove" which is the moving scrollbar.
> > 
> > http://anybase.co.nf
> > 
> > var xKeylength=0;
> > var xFrontStart=0;
> > var xBackEnd=0;
> > 
> > function pianoSCROLL(){
> >    var keyreleased=false;
> >    if(mess.data[0]==NOTE_ON){
> >       ctm.fillStyle = "red";
> >       ctm.fillRect(xBackEnd,(PistartX+keyHeight*88)-(keyHeight*(mess.data[1]-8)), xFrontStart, keyHeight);
> >       if(FRONT==0) {FRONT=totalmove;}
> >       xBackEnd=keylength;
> >       xFrontStart=totalmove-FRONT+keylength;
> >     
> >    } else if(mess.data[0]==NOTE_OFF){
> >     console.log("keyreleased!");
> >     keyreleased=true;
> >     xBarLength=xFrontStart-xBackEnd;
> >     ctm.fillStyle = "black";
> >     ctm.fillRect(keylength, (PistartX+keyHeight*88)-(keyHeight*(mess.data[1]-8)), 600, keyHeight+2);
> >    }
> >    if (keyreleased) {
> >     console.log("timebar moving");
> >     xFrontStart=totalmove-FRONT+keylength;
> >     xBackEnd=xFrontStart-xBarLength;
> >     ctm.fillStyle = "black";
> >     ctm.fillRect(keylength, (PistartX+keyHeight*88)-(keyHeight*(mess.data[1]-8)), Mwidth, keyHeight+2);
> >     ctm.fillStyle = "red";
> >     ctm.fillRect(xFrontStart,(PistartX+keyHeight*88)-(keyHeight*(mess.data[1]-8)),xBackEnd, keyHeight);
> >   }
> > }
> 
> Anyone got any ideas about what values go wrong, and why?

I just saw i reversed the Start and End, but that is not the main problem the front cursor still raise "to fast" and speed by the scrollbar. I start to think it doing double laps because the code just copied from the upper adding. 

Maybe it goes into NOTE ON to?

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Moving pianoscrollbar get wavy Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-02-27 12:10 -0800
  Re: Moving pianoscrollbar get wavy Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-02-27 13:35 -0800
    Re: Moving pianoscrollbar get wavy Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-02-27 13:55 -0800
  Re: Moving pianoscrollbar get wavy Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-02-27 22:00 -0800
    Re: Moving pianoscrollbar get wavy Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-02-27 23:20 -0800
  Re: Moving pianoscrollbar get wavy Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-02-28 04:31 -0800
    Re: Moving pianoscrollbar get wavy Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-02-28 05:29 -0800
      Re: Moving pianoscrollbar get wavy Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-03-12 17:58 -0700

csiph-web