Animate panel colors
-
Before I script my own lookup table and decimal-to-hex function, is there a quick way to animate the colors of a panel like this?
-
@dustbro I don't think there is a built in way to do that. I wrote a colour picker some years ago which might be helpful here:
https://forum.hise.audio/topic/395/example-of-themed-gui/5?_=1649868697343
-
@d-healey This link was really helpful. I was about to design an archaic and primitive system to convert decimal to Hex.
-
@dustbro Look at this function I just discovered in JUCE - https://docs.juce.com/master/classString.html#aab501daf0fa0bbba1479218447d1f936
Maybe I should add it to HISE?
-
@d-healey That would be a helpful addition to my current task :)
-
@dustbro
I've added it to the Engine class. @Christoph-Hart Is this a good place for it? JUCE has it as part of the string class but I'm not sure that makes sense in HISE.
-
@d-healey Yes, I've waited for this, thank you David!
-
@ulrik @dustbro I pushed to my fork and made a pull request.
-
@dustbro I guess you could add a shader (panel) and take the basic shadertoy init code as a startup! https://www.shadertoy.com/new
-
@dustbro @d-healey I found a simple function here to convert decimal to hex string, but it hasn't been fully tested yet.
inline function toHex(num, digits) { local hexTable = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F"]; local n = num; local s = digits; local result = ""; while (s--) { result = hexTable[n & 0xF] + result; n = n >> 4; } return result; } Console.print(toHex(4278221567, 8)); // output: FF007AFF
By the way, using HSV or HSL makes it easier to control color variations, just change the value of Hue as you did in the colorpicker.
You may need to use some functions that convert between RGB and HSV/HSL. -
@UrsBollhalder I'm going to dig into shaders after my next product release. The possibility seem really impressive.
-
@dustbro There's also a bunch of helper functions in the
Colours
API Class:https://docs.hise.audio/scripting/scripting-api/colours/index.html
They should give you most color manipulation functions without having to resort to hex numbers and weird bit shuffling.
-
And a little example:
HiseSnippet 837.3ocsUs0aSCCE1tqAsVXHlD+.h1SYhQUJ6BHgPzsdApfsUniIda343zXsD6nDmsUglD+Y4c9G.GGm1zwpFaUh7PUO274ymy243AIRJKMUlfv0NZbLCgej0vwBUP6.BWf52Ager09jTEKw1nZuwwjzTlGBiW5cZE3ZUQ4e+5s6QBIBJqTEBcrjSY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