HISE Logo Forum
    • Categories
    • Register
    • Login

    Animate panel open/close from R to L

    Scheduled Pinned Locked Moved General Questions
    5 Posts 2 Posters 355 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.
    • gorangroovesG
      gorangrooves
      last edited by

      I am trying to animate a panel to open from R to L instead of the default L to R (and close it).

      @d-healey I am trying to repurpose your script while adding the X location, but I am not managing to accomplish that.

      Here is the script I came up with that is NOT giving me satisfactory results. In this case, I am just trying to expand/contract the width of the panel to the left while keeping the right side stationary.

      Content.makeFrontInterface(600, 500);
      
      
      // btnOpen
      const var btnOpenClose = Content.getComponent("btnOpenClose");
      
      btnOpenClose.setValue(0);
      
      inline function onbtnOpenCloseControl(component, value)
      {
          pnlAni.data.open = value;
          pnlAni.startTimer(10);
      };
      
      Content.getComponent("btnOpenClose").setControlCallback(onbtnOpenCloseControl);
      
      // pnlAni
      const var pnlAni = Content.getComponent("pnlAni");
      pnlAni.setPosition(150, 138, 100, 145);
      var pnArray = pnlAni.getLocalBounds(0);
      
      var x = pnArray[0];
      var y = pnArray[1];
      
      pnlAni.setTimerCallback(function(){
             
          if (this.data.open)
       
      	this.setPosition(x - 10, 138, this.getWidth() + 10, 145);
              
          else
              
              this.setPosition(x - 10, 138, this.getWidth() - 10, 145);
          
          if (this.getWidth() > 250 || this.getWidth() < 100)
              this.stopTimer();
      });
      
      

      What am I missing here/ doing wrong, please?

      Goran Rista
      https://gorangrooves.com

      Handy Drums and Handy Grooves
      https://library.gorangrooves.com

      1 Reply Last reply Reply Quote 0
      • d.healeyD
        d.healey
        last edited by

        HiseSnippet 987.3ocsV0saaaCElxIJq1aoXcn2N.gbkyVZfbaW1FLFparS5L5RpvTRatKfVhxlvTjBhTIwon2smm8FLr8pr2f8FrcHkrE8pQVqAluvvme9H+NjmyGcPtHhHkhbjSyylkQPNela3LtZR+IXJGMb.x49tmfkJRtWoqCmkgkR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kQQ5x+QcPnUi4wqAlmrFXd5Zf4aVCLGrFX910.y2cmXz+ymmWnDokiCfifiLh2NNGwwPmkoKD8O.8Jfrg
        

        Peek 2022-09-13 22-35.gif

        Libre Wave - Freedom respecting instruments and effects
        My Patreon - HISE tutorials
        YouTube Channel - Public HISE tutorials

        gorangroovesG 1 Reply Last reply Reply Quote 1
        • gorangroovesG
          gorangrooves @d.healey
          last edited by

          @d-healey Wow, man. You are too fast! :beaming_face_with_smiling_eyes: I shall give this a try now. Thank you so much!

          Goran Rista
          https://gorangrooves.com

          Handy Drums and Handy Grooves
          https://library.gorangrooves.com

          gorangroovesG 1 Reply Last reply Reply Quote 1
          • gorangroovesG
            gorangrooves @gorangrooves
            last edited by gorangrooves

            @d-healey I managed to combine your scripts to achieve the desired results!

            Here it is, should someone else need it.

            Content.makeFrontInterface(600, 500);
            
            
            // btnOpen
            const var btnOpenClose = Content.getComponent("btnOpenClose");
            
            btnOpenClose.setValue(0);
            
            inline function onbtnOpenCloseControl(component, value)
            {
                pnlAni.data.open = value;
                pnlAni.startTimer(10);
            };
            
            Content.getComponent("btnOpenClose").setControlCallback(onbtnOpenCloseControl);
            
            // pnlAni
            const var pnlAni = Content.getComponent("pnlAni");
            const pnlX = 180;
            const pnlMaxWidth = 100;
            
            pnlAni.setTimerCallback(function(){
                   
                if (this.data.open)
                    {
            	        
                    	this.set("width", this.getWidth() + 10);
                    	this.set("x", pnlX + pnlMaxWidth - this.getWidth());
                    
                    }
            
                    
                else
                    {
            	        
                    	this.set("width", this.getWidth() - 10);
                    	this.set("x", pnlX + pnlMaxWidth - this.getWidth());
                    }
            
                
                if (this.getWidth() > pnlMaxWidth - 1)
                    {
                        this.set("width", pnlMaxWidth);
                        this.stopTimer();
                    }
                
                else if (this.getWidth() < 1)
                    {
                        this.set("width", 0);
                        this.stopTimer();
                    }
                    
            });
            
            

            And here is the HiseSnippet

            HiseSnippet 1052.3ocsV8taaaCDmxIJH1ctXEXO.D4SxnINxcscEH6OtwIov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2p4UxE.oCU5Qp5CxyXx41yybuzO+tR2G4NjICltZ9VaE7ERftu4a9zQMcOdxDZfrjra5dx6t+GEB8mhYRF+7ADYJCRvbOcV7HHcHfBLgCofpmrN0TOtL68U6UQlQTdndyGgUtvNp8N4B6THDESBREuOvTnPM+01ZDfSb8Xn0g4gg83NHcwCvNW+19nXXrv2GDnBE6Abe017j0vlebMr4oqgMOaMr44qgM+zZXyK9h1nlH+kyjhXyyD.X3w5JpNNGyIPVlNiD8ILCOy0H
            

            Thanks to you, @d-healey, I am getting stuff done and learning simultaneously. Thanks a million!

            Goran Rista
            https://gorangrooves.com

            Handy Drums and Handy Grooves
            https://library.gorangrooves.com

            gorangroovesG 1 Reply Last reply Reply Quote 3
            • gorangroovesG
              gorangrooves @gorangrooves
              last edited by

              Edit: Added a failsafe rule to reset the panel size if it falls outside of the set perimeters and stops the timer, as on subsequent script recompiles, the panel can keep shifting position until it is outside of the interface and can not show up.

              Goran Rista
              https://gorangrooves.com

              Handy Drums and Handy Grooves
              https://library.gorangrooves.com

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

              17

              Online

              1.7k

              Users

              11.8k

              Topics

              102.4k

              Posts