Forum

    • Register
    • Login
    • Search
    • Categories

    Percentage on lavel

    General Questions
    2
    5
    111
    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.
    • A
      arminh last edited by

      Im trying to put percentage value from knob to label.
      But I can't convert value to percentage, how I can convert 0.00 to 0%? I tried JS solutions but without success

      1 Reply Last reply Reply Quote 0
      • Christoph Hart
        Christoph Hart last edited by

        parseInt() is what you‘re looking for.

        A 1 Reply Last reply Reply Quote 0
        • A
          arminh @Christoph Hart last edited by arminh

          @Christoph-Hart im not sure what im doin wrong

          inline function onsaturationControl(component, value)
          {
              local v = saturationKnob.getValue();
              
          	Content.setPropertiesFromJSON("saturationLabel", {
          	    "text": parseInt(v),
          	});
          };
          
          Content.getComponent("saturation").setControlCallback(onsaturationControl);
          

          But I get only 0 or 1 on max

          1 Reply Last reply Reply Quote 0
          • Christoph Hart
            Christoph Hart last edited by

            parseInt(v * 100). Normalised percentage means that the range is from 0 to 1.

            A 1 Reply Last reply Reply Quote 0
            • A
              arminh @Christoph Hart last edited by

              @Christoph-Hart thanks!

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

              10
              Online

              732
              Users

              5.4k
              Topics

              50.2k
              Posts