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


Groups > comp.lang.javascript > #36071

Re: Moving pianoscrollbar get wavy

Newsgroups comp.lang.javascript
Date 2019-02-27 23:20 -0800
References <7274cd03-fd2c-4c8c-ab26-a0a16155ad00@googlegroups.com> <a6847856-550e-41d0-92d3-232898382eb6@googlegroups.com>
Message-ID <c02bd7ab-b5a4-45fa-977d-edbde6133427@googlegroups.com> (permalink)
Subject Re: Moving pianoscrollbar get wavy
From Jonas Thörnvall <jonas.thornvall@gmail.com>

Show all headers | View raw


Den torsdag 28 februari 2019 kl. 07:00:26 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);
> >   }
> > }
> 
> I guess what i do not get is.
> How could the **moving barlength** not be "constant" given that xBarLength is FIXED LENGTH?
> 
>  xFrontStart=totalmove-FRONTOFFSET+keylength;
>  xBackEnd=xFrontStart-xBarLength;
> 
>    ctm.fillRect(xFrontStart,(PistartX+keyHeight*88)-(keyHeight*(mess.data[1]-8)),xBackEnd, keyHeight); 
> 
> Given above how can the frontstart vary the backend it seem unlogical? 
> Totalmove is just the updated progression *xposition* between each render call in "FPS" using timer, dependent upon the scope  "number of bars" shown on canvas.

Renamed totalmove to scrollBarPos seemed more logical

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