HISE Logo Forum
    • Categories
    • Register
    • Login

    Vertical + horizontal slider script

    Scheduled Pinned Locked Moved Presets / Scripts / Ideas
    3 Posts 2 Posters 686 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.
    • L
      Lumi283
      last edited by

      Hello, for those who want to save time, here's a simple script for a horizontal slider in Look and Feel, as I didn't find one in the forum. It's up to you to customize this script and assign your own colors.
      cf267046-d82e-4879-bb68-f5384668dc49-image.png

              //horizontal slider
      	laf.registerFunction("drawLinearSlider", function(g, obj)
      	{
      		var a = obj.area;
      	 	g.setColour(Colours.blue);
      	 	g.fillRoundedRectangle([0, 10, a[2], 12], 6);
      	 	var x = obj.valueNormalized * a[2];
      	 	g.setColour(Colours.red);
      	 	g.fillRoundedRectangle([0, 10, x , 12], 6);
      	 	g.setColour(Colours.green);
      	 	g.fillRoundedRectangle([x - 6 , 0, 12, 30], 6);
      	});
      	
      
             //vertical slider
      	laf.registerFunction("drawLinearSlider", function(g, obj)
      		{
      			var a = obj.area;
      		 	g.setColour(Colours.blue);
      		 	g.fillRoundedRectangle([9, 0, 12, a[3]], 6);
      		 	var x = obj.valueNormalized * a[3];
      		 	g.setColour(Colours.red);
      		 	g.fillRoundedRectangle([9, 0, 12 , x], 6);
      		 	g.setColour(Colours.green);
      		 	g.fillRoundedRectangle([0 , x - 6, 30, 12], 6);
      		});
      
      d.healeyD 1 Reply Last reply Reply Quote 6
      • d.healeyD
        d.healey @Lumi283
        last edited by

        @Lumi283

        Hey that looks nice and clean.

        I have two suggestions.

        Use local look and feel, so each laf object has a different name. lafVerticalSlider, lafHorizontalSlider, etc.

        Instead of hardcoding the colours use the colour properties of the components (they are available in obj).

        Free HISE Bootcamp Full Course for beginners.
        YouTube Channel - Public HISE tutorials
        My Patreon - HISE tutorials

        L 1 Reply Last reply Reply Quote 1
        • L
          Lumi283 @d.healey
          last edited by

          @d-healey Thank you, I am taking notes!

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

          33

          Online

          2.0k

          Users

          12.7k

          Topics

          110.0k

          Posts