HISE Logo Forum
    • Categories
    • Register
    • Login

    Panel animation movement

    Scheduled Pinned Locked Moved Solved General Questions
    28 Posts 5 Posters 1.1k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Matt_SFM
      Matt_SF @Sawer
      last edited by

      @Sawer that's odd, because if you load the snippet I posted, the panel moves correctly when pressing a key. I simply moved the start/stop timer calls to the appropriate CB tabs.

      Develop branch
      Win10 & VS17 / Ventura & Xcode 14. 3

      S 1 Reply Last reply Reply Quote 0
      • S
        Sawer @Matt_SF
        last edited by

        @Matt_SF
        Uhm..
        Does yours move backwards after reaching the final point?

        Matt_SFM 1 Reply Last reply Reply Quote 0
        • Matt_SFM
          Matt_SF @Sawer
          last edited by Matt_SF

          @Sawer I just got it to move but if you want to move it back and forth you have to create another variable which holds the direction of the panel and change the direction when the panel reaches the value you want.

          Try this :

          HiseSnippet 931.3ocsV0saaaCElzIrnRaEXEXO.B4JEzl.4z1kBTTL23jL3skTg4tfsq5XjnsHhDo.EcSMJBvdN1E6YYOR6Mn6PR8mScFFLVMfMz4mOxuC024PGqjIrpJoBg8dyxRFB+kjoKE5rwYTt.M4XD99jXEqhoQGsrjVUwRQX7VemIJ1aaj8ye+sGQyohDVmKD5BIOg8i7Bttya7nefmmeJMk8FdQure5nIIRwXYtbAvjsHQnRZxUz4ryolzFPP36cRJWKUS0TMqBg29HY5xoYxqEt7ufWwuLmYLFhlBKjy8ox7TCiMdQiy34owMUbEBVk3t5eKW8+0jy3o7V+cmCekMPPGh9mG3AqRusVgdC6SundzaMTB2iRa6nzCISST7RcWDCe9BxDglolQgi89TwkKZveLfLVBYHz6WPuhcpBLZQD9rnnGG.+r6K788gy9Jcv6npfRQ9qD7fWFz.cNSOVVTJEfQ3Ntv6.f5fDSEr7g2IDWXCjZLYL97LMj+vCO7E9J17fTthkn4RAjiaG1GzawxJtwYHPTKWMeszsKGiJRMllmeIHWBmsPXWlvc8+fumsbjU+JrS0..hEtyRCU7783yBBcgeYPzt9ddsr..DAovxqXA8yxQ7am5v1Uqm25kzf7QOpdsps2aOvFPr1B0tU8pUOcFuZeEqDDg5PvwMv2lxLPJNWpYuttdaVPMU4NWBehYItwO31.lM6VHjkN.eR5lWoJYdtIlAwsBWiZMQpAFJVTbIS8XPnjuf0lHnrWscgb2sK86lSbJrdIJESDb8qKYh6pGGUKKgm94IGS0TSOVsOHuRlRyMT.eL6cv.KWGmG4XV0Uv4hM2ZsLLCRai9fl9QizFwSsyHsxbz66OAbYqwuewnq4o5rVG+1MibxoVO+U9nU1Ku6dubu2L6EAWuOD7eBOTuGD7AfQy56r3ZVQy7Uu688We1GQq38f9tKoJfC8HSa8g9zoSvbQY5hbpd0gklaHpC.RhUlPYlBI.M+x92f7+1Dz+qT7gjXtNIa8bbvZ3HHb9bvw56cd.4jYyf4GcDbaxo+xmmKYP+jbglKleFUq3FYz4KJlBhfDFr6B3EsokDOvz73riZjZSYhTqwGgO0AGZrw0AG1DDUPSTx2l3FDXtY69VO.mD1K08HmYrCFhrCG.bjn8iPEvkruMIwT96A5s0i4fM.yS1.LOcCv7rM.y2rAXNbCv77+ULl+eyqVnkEt1AvQ7I1IlX7IBJnrrpPz+.CNAw0B
          

          Develop branch
          Win10 & VS17 / Ventura & Xcode 14. 3

          S 3 Replies Last reply Reply Quote 1
          • S
            Sawer @Matt_SF
            last edited by

            @Matt_SF Ok thanks. 🙏
            Will try the snippet in a bit.

            1 Reply Last reply Reply Quote 0
            • S
              Sawer @Matt_SF
              last edited by

              @Matt_SF Man it works!!!
              Will compare the code and give feedback on where I messed up. Thanks so much man!!

              1 Reply Last reply Reply Quote 1
              • S Sawer has marked this topic as solved on
              • S
                Sawer @Matt_SF
                last edited by

                @Matt_SF Hello man.
                Thanks again for the snippet.
                Trying to figure out how and why you got it right and what was missing on my side. I tried iterating through your code to understand it, but I'm still not getting it.

                const var pnlAni = Content.getComponent("pnlAni");
                const var Panel1 = Content.getComponent("Panel1");
                
                
                
                pnlAni.setPosition(0, 0, 50, 50);
                
                
                pnlAni.setTimerCallback(function()
                {
                	var posY = pnlAni.get("y");
                	
                	if (posY == 0)
                		posY++;
                	
                	else if (posY == 177)
                		posY--;
                		
                	pnlAni.setPosition(0,posY , 50, 50);
                	this.repaint();
                });
                

                This is what I created based on your working snippet. It's not working and I'm not understanding why. Based on my logic, I think this code is right (which is totally not), and I want to understand why I think this is. What am I missing here?

                LindonL 1 Reply Last reply Reply Quote 0
                • LindonL
                  Lindon @Sawer
                  last edited by

                  @Sawer look at your code:

                  if posY == 0 -- do something...
                  if posY == 177 do something...

                  So assuming posY == 0 the first time, what happens then? and what does posY ==?

                  HISE Development for hire.
                  www.channelrobot.com

                  S 1 Reply Last reply Reply Quote 0
                  • S
                    Sawer @Lindon
                    last edited by

                    @Lindon It does nothing. Because is neither equal to 0 or 177. True, thanks..

                    LindonL 1 Reply Last reply Reply Quote 0
                    • LindonL
                      Lindon @Sawer
                      last edited by

                      @Sawer said in Panel animation movement:

                      @Lindon It does nothing. Because is neither equal to 0 or 177. True, thanks..

                      correct so try this:

                      var summingValue = -1;
                      
                      pnlAni.setTimerCallback(function()
                      {
                      	var posY = pnlAni.get("y");
                      	
                      	if (posY == 0)
                      		summingValue = 1;
                      	
                      	if (posY == 177)
                      		summingValue = -1;
                      
                              posY = posY + summingValue;
                      
                      
                      		
                      	pnlAni.setPosition(0,posY , 50, 50);
                      	this.repaint();
                      });
                      

                      HISE Development for hire.
                      www.channelrobot.com

                      Matt_SFM 1 Reply Last reply Reply Quote 1
                      • Matt_SFM
                        Matt_SF @Lindon
                        last edited by

                        @Lindon I would never have thought of doing it like this. Nice 👍

                        Develop branch
                        Win10 & VS17 / Ventura & Xcode 14. 3

                        S 1 Reply Last reply Reply Quote 0
                        • S
                          Sawer @Matt_SF
                          last edited by

                          @Lindon Thanks so much for the explanation and the new code!

                          1 Reply Last reply Reply Quote 0
                          • First post
                            Last post

                          19

                          Online

                          1.7k

                          Users

                          11.9k

                          Topics

                          103.6k

                          Posts