HISE Logo Forum
    • Categories
    • Register
    • Login

    Panel animation movement

    Scheduled Pinned Locked Moved Solved General Questions
    28 Posts 5 Posters 1.8k 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.
    • 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

                    16

                    Online

                    2.0k

                    Users

                    12.7k

                    Topics

                    110.1k

                    Posts