It is currently April 20th, 2024, 1:33 pm

fading trough 3 colors... how to do it?

Get help with creating, editing & fixing problems with skins
User avatar
brax64
Posts: 172
Joined: July 8th, 2018, 8:05 pm

Re: fading trough 3 colors... how to do it?

Post by brax64 »

Yincognito wrote: August 9th, 2020, 12:17 am Until eclectic-tech or jsmorley help you with the Lua variant, I know you try all the options and all, but just wanted to make sure: you did manage to integrate my variant into your volume code when you tried it, didn't you? Cause I never asked... :D


I think you should let that line there, as it belongs to a function. You should double check if you copied the script accordingly from eclectic-tech's post (don't mess with the encoding of the file, by the way, just paste in bare Notepad), because I tried his code again, this time in my @Resources folder and it works without issues.


Apart from the fact that I'm not sure this is a problem with the code posted by eclectic-tech, this only confirms what I talked about earlier: when the Lua code needs to be adjusted (not sure it's the case here, but for the sake of the argument), the "practical" and "easy" Lua solution suddenly becomes a bit different for the regular user, unlike a native code one, where it is assumed the user knows more or less how to deal with it.
Hi Yincognito,

Yes, I surely did, I made 3 different version using your approach, the balala's one and lately the lua;
So summarizing, the point from your last post (adding more "coding" issues with lua) is spot on 100% (I did experience it myself...)
Then my observation regarding a total native code approach vs the lua's one, is that, at least in my case playing with Volume as trigger, the lua's one is less CPU demanding...
User avatar
Yincognito
Rainmeter Sage
Posts: 7129
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: fading trough 3 colors... how to do it?

Post by Yincognito »

brax64 wrote: August 9th, 2020, 12:31 am Hi Yincognito,

Yes, I surely did, I made 3 different version using your approach, the balala's one and lately the lua;
So summarizing, the point from your last post (adding more "coding" issues with lua) is spot on 100% (I did experience it myself...)
Then my observation regarding a total native code approach vs the lua's one, is that, at least in my case playing with Volume as trigger, the lua's one is less CPU demanding...
Ah, ok - just wanted to make sure my code worked in your case. :thumbup:
Regarding the CPU usage, what do you mean? I tested both my variant and eclectic-tech's one side by side and my CPU usage was fine at 0.39% (normal for my skin suite in the background, when on idle). I too wanted to make sure there are no CPU usage differences between our two attempts, and from my tests there were none (just like I expected).
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
brax64
Posts: 172
Joined: July 8th, 2018, 8:05 pm

Re: fading trough 3 colors... how to do it?

Post by brax64 »

Yincognito wrote: August 9th, 2020, 12:39 am Ah, ok - just wanted to make sure my code worked in your case. :thumbup:
Regarding the CPU usage, what do you mean? I tested both my variant and eclectic-tech's one side by side and my CPU usage was fine at 0.39% (normal for my skin suite in the background, when on idle). I too wanted to make sure there are no CPU usage differences between our two attempts, and from my tests there were none (just like I expected).
On idle state there's not difference; while playing with the mouse wheel increasing/decreasing the Volume, thus activating the color fading thing, I notice just a few tenths of % difference (like 0.2/0.3) but I don't think is a value that apply universally, It surely depend by the pc build (cpu type, ram and so on), in my case I don't have a very powerful pc so messing around with animation and such it affect performance considerably...
User avatar
Yincognito
Rainmeter Sage
Posts: 7129
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: fading trough 3 colors... how to do it?

Post by Yincognito »

brax64 wrote: August 9th, 2020, 12:47 am On idle state there's not difference; while playing with the mouse wheel increasing/decreasing the Volume, thus activating the color fading thing, I notice just a few tenths of % difference (like 0.2/0.3) but I don't think is a value that apply universally, It surely depend by the pc build (cpu type, ram and so on), in my case I don't have a very powerful pc so messing around with animation and such it affect performance considerably...
Yeah, but that is normal when you mouse scroll on it, and not necessarily because of the fading, but because the Win7Audio measure is getting triggered and makes those changes to the audio level. The audio plugins (both of them, Win7Audio and AudioLevel) are prone to such CPU usage issues, from my experience.

Anyway, it doesn't matter which variant you choose, really - the important thing is that you're happy with it. I'm more than ok knowing that you managed to integrate my variant into your code seamlessly, although I have serious doubts regarding the CPU usage difference (I too have a slower CPU). In any case, not to worry, just enjoy whatever code suits you, and fade your way into a fountain of colors... 8-)
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
brax64
Posts: 172
Joined: July 8th, 2018, 8:05 pm

Re: fading trough 3 colors... how to do it?

Post by brax64 »

Yincognito wrote: August 9th, 2020, 1:29 am Yeah, but that is normal when you mouse scroll on it, and not necessarily because of the fading, but because the Win7Audio measure is getting triggered and makes those changes to the audio level. The audio plugins (both of them, Win7Audio and AudioLevel) are prone to such CPU usage issues, from my experience.

Anyway, it doesn't matter which variant you choose, really - the important thing is that you're happy with it. I'm more than ok knowing that you managed to integrate my variant into your code seamlessly, although I have serious doubts regarding the CPU usage difference (I too have a slower CPU). In any case, not to worry, just enjoy whatever code suits you, and fade your way into a fountain of colors... 8-)
Yep, from a simple question this turned out in a great ride! Open up other aspects and a very rewarding learning curve for me, Thank you very much for all your support and to all the others too!
User avatar
balala
Rainmeter Sage
Posts: 16148
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: fading trough 3 colors... how to do it?

Post by balala »

Yincognito wrote: August 9th, 2020, 12:31 am Why not trying to add colors into a string, like "255,0,0;0,255,0;0,0,255;..." and validate the colors or find their number based on that? I mean, I know it involves a bit of regex (or a bit more, LOL), but it would help avoid creating so many measures and allow you to do this in one or two measures instead...
Obviously there are more possible solutions to the same problem. Mine was one of them.
User avatar
Yincognito
Rainmeter Sage
Posts: 7129
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: fading trough 3 colors... how to do it?

Post by Yincognito »

balala wrote: August 9th, 2020, 11:11 am Obviously there are more possible solutions to the same problem. Mine was one of them.
Yep, I think I'll work on a code to turn your 25+ measures into 2 or 3, just to see if and how it can be done. String measures are absolutely GREAT at aggregating lots of values and even turning those values into bangs to set variables or whatnot, through regex substitutions. I actually recommended the same approach to someone else yesterday, to turn a mile long chain of !WriteKeyValues into just one such bang in order to shorten up code. I understand the reluctance to apply such methods since regex is a bit of a mountain to climb for lots of folks, but such approaches certainly do their job.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
balala
Rainmeter Sage
Posts: 16148
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: fading trough 3 colors... how to do it?

Post by balala »

Yincognito wrote: August 9th, 2020, 11:43 am Yep, I think I'll work on a code to turn your 25+ measures into 2 or 3, just to see if and how it can be done.
Alright, post the code if you're ready with it, please.
User avatar
Yincognito
Rainmeter Sage
Posts: 7129
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: fading trough 3 colors... how to do it?

Post by Yincognito »

balala wrote: August 9th, 2020, 11:46 am Alright, post the code if you're ready with it, please.
Okeydokey.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: fading trough 3 colors... how to do it?

Post by jsmorley »

Yincognito,

I'm not in any way suggesting that jumping to HSB in Lua is a better way to attack "transitioning" between two colors in Rainmeter. The math involved in properly and logically altering hue/saturation/brightness, while not rocket science, is no less complicated than logically altering red/green/blue to achieve the result of fading between say 227,32,0 and 0,159,6. In fact maybe in some ways it is more complicated, since the saturation and brightness are a "percentage" and are pretty easy to deal with, while "hue" is a number between 0 and 360 degrees, and takes a different approach than the other two. You in effect need to change the "hue" into a percentage difference between the starting and ending hue.

In either case, RGB or HSB, there are complexities with "how fast" you transition each of the components, in order to get a smooth, equal transition. For instance, going from 227,32,0 to 0,159,6, you are going to want to change the "red" in larger increments than you change the value for "green", so in effect they both arrive at the "destination" more or less at the same time.