Forum
    • Categories
    • Register
    • Login

    Setting the alpha of a color individually?

    Scheduled Pinned Locked Moved General Questions
    16 Posts 2 Posters 1.7k 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.
    • David HealeyD
      David Healey @Felix W
      last edited by

      @CatABC

      You need to "reset" your keyboard before assigning the new colours. You can do that like this

      for (i = 0; i < 128; i++)
          Engine.setKeyColour(i, 0x0);
      

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

      Felix WF 1 Reply Last reply Reply Quote 0
      • Felix WF
        Felix W @David Healey
        last edited by

        @d-healey
        This doesn't seem to work, am I doing something wrong?

        if (value == 2){
            for (i = 0; i < 128; i++)
                  {
            		Engine.setKeyColour(i, 0x0);
            	   }
        
             local Ens2 = [36, 38, 40, 43, 48, 50, 52, 55, 60, 62, 64, 67, 84];		   	
                   for (i = 0; i < Ens2.length; i++)
                	{
                		Engine.setKeyColour(Ens2[i], Colours.withAlpha(Colours.blue, 0.3));
                	};
                 }
        

        5096f792-7d50-440a-b3d2-8897f2fb614a-image.png

        //I am a new student at HISE._
        //Windows11 & MacOS Ventura 13.6.7_

        David HealeyD 1 Reply Last reply Reply Quote 0
        • David HealeyD
          David Healey @Felix W
          last edited by

          @CatABC You don't need to put the reset within the if statement, it can go before all of your keyboard colouring code.

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

          Felix WF 1 Reply Last reply Reply Quote 0
          • Felix WF
            Felix W @David Healey
            last edited by Felix W

            @d-healey Unfortunately, he still has the same result. My guess is that because I used a button to trigger the color change, when the button value does not change, it will continue to keep the button callback result.
            What should I write in the else of the button to make it return to the color before it changed?

            //I am a new student at HISE._
            //Windows11 & MacOS Ventura 13.6.7_

            David HealeyD 1 Reply Last reply Reply Quote 0
            • David HealeyD
              David Healey @Felix W
              last edited by

              @CatABC can you make a minimal snippet that shows the problem?

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

              Felix WF 2 Replies Last reply Reply Quote 0
              • Felix WF
                Felix W @David Healey
                last edited by

                @d-healey ChangeColor.zip
                The code snippet didn't seem to show the problem, so I uploaded a project, and along the way I found the source of the problem. When the button is in a Panel, it causes the problem.

                //I am a new student at HISE._
                //Windows11 & MacOS Ventura 13.6.7_

                1 Reply Last reply Reply Quote 0
                • Felix WF
                  Felix W @David Healey
                  last edited by

                  @d-healey There is no problem switching with Combobox, but there is a problem with switching with preset browsers

                  //I am a new student at HISE._
                  //Windows11 & MacOS Ventura 13.6.7_

                  David HealeyD 1 Reply Last reply Reply Quote 0
                  • David HealeyD
                    David Healey @Felix W
                    last edited by

                    @CatABC This is what I see in your project, looks like it's working?

                    Peek 2025-01-14 15-09.gif

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

                    Felix WF 1 Reply Last reply Reply Quote 0
                    • Felix WF
                      Felix W @David Healey
                      last edited by

                      @d-healey Oh, sorry, I forgot to save the latest data when I was testing the code snippet,
                      ChangeColor2.zip
                      1.gif

                      //I am a new student at HISE._
                      //Windows11 & MacOS Ventura 13.6.7_

                      David HealeyD 1 Reply Last reply Reply Quote 0
                      • David HealeyD
                        David Healey @Felix W
                        last edited by

                        @CatABC Turn off saveInPreset for your button.

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

                        Felix WF 1 Reply Last reply Reply Quote 0
                        • Felix WF
                          Felix W @David Healey
                          last edited by

                          @d-healey Ahaha,god,It's so simple
                          Feeling mine so stupid。,Thanks very much David, you solved my problem again.😙 😙 😙

                          //I am a new student at HISE._
                          //Windows11 & MacOS Ventura 13.6.7_

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

                          34

                          Online

                          2.1k

                          Users

                          13.0k

                          Topics

                          113.0k

                          Posts