It is currently April 19th, 2024, 2:07 pm

setting random color and fade-out effect

Get help with creating, editing & fixing problems with skins
EmmJey
Posts: 14
Joined: August 5th, 2022, 11:18 am

Re: setting random color and fade-out effect

Post by EmmJey »

tass_co wrote: August 8th, 2022, 1:59 am Unfortunately, I had to lower the update rate to 100 for the transition effect to be smooth :(
I am sharing the skin file so that you do not experience the previous renewal problem :great:

Code: Select all

[Rainmeter]
Update=100

[Variables]
Period=12
UU=[!UpdateMeasureGroup "Color"][!UpdateMeter "MeterValues"][!UpdateMeter "MeterFacebook"][!Redraw]
Var=1

[c00]
Measure=Calc
Formula=FRAC([CalcFade]/12)
DynamicVariables=1

[c01]
Measure=Calc
Formula=#Var#
DynamicVariables=1

[c11]
Measure=Calc
Formula=TRUNC([Measure11]/100)/120
DynamicVariables=1

[c12]
Measure=Calc
Formula=TRUNC([Measure12]/100)/120
DynamicVariables=1

[c13]
Measure=Calc
Formula=TRUNC([Measure13]/100)/120
DynamicVariables=1

[c21]
Measure=Calc
Formula=TRUNC([Measure21]/100)/120
DynamicVariables=1

[c22]
Measure=Calc
Formula=TRUNC([Measure22]/100)/120
DynamicVariables=1

[c23]
Measure=Calc
Formula=TRUNC([Measure23]/100)/120
DynamicVariables=1

[c31]
Measure=Calc
Formula=TRUNC([Measure31]/100)/120
DynamicVariables=1

[c32]
Measure=Calc
Formula=TRUNC([Measure32]/100)/120
DynamicVariables=1

[c33]
Measure=Calc
Formula=TRUNC([Measure33]/100)/120
DynamicVariables=1

[MeasureTime]
Measure=Calc
Formula=(MeasureTime +1) % #Period# 
IfEqualValue=((#Period#)-1)
IfEqualAction=[!UnPauseMeasure CalcFade][!DisableMeasure MeasureTime][!SetVariable Var "0"]
UpdateDivider=12

[CalcFade]
Measure=Calc
Formula=(CalcFade - 1+(12))%(12)
IfCondition= CalcFade <1
IfTrueAction=[!PauseMeasure CalcFade][!EnableMeasure MeasureTime][!SetVariable Var "1"]#UU#
DynamicVariables=1


[Measure11]
Measure=Calc
Formula=Random
LowBound=0
HighBound=10000
UpdateRandom=1
UpdateDivider=-1
Group=Color
UniqueRandom=1

[Measure12]
Measure=Calc
Formula=Random
LowBound=0
HighBound=10000
UpdateRandom=1
UpdateDivider=-1
Group=Color
UniqueRandom=1

[Measure13]
Measure=Calc
Formula=Random
LowBound=0
HighBound=10000
UpdateRandom=1
UpdateDivider=-1
Group=Color
UniqueRandom=1

[Measure21]
Measure=Calc
Formula=Random
LowBound=0
HighBound=10000
UpdateRandom=1
UpdateDivider=-1
Group=Color
UniqueRandom=1

[Measure22]
Measure=Calc
Formula=Random
LowBound=0
HighBound=10000
UpdateRandom=1
UpdateDivider=-1
Group=Color
UniqueRandom=1

[Measure23]
Measure=Calc
Formula=Random
LowBound=0
HighBound=10000
UpdateRandom=1
UpdateDivider=-1
Group=Color
UniqueRandom=1

[Measure31]
Measure=Calc
Formula=Random
LowBound=0
HighBound=10000
UpdateRandom=1
UpdateDivider=-1
Group=Color
UniqueRandom=1

[Measure32]
Measure=Calc
Formula=Random
LowBound=0
HighBound=10000
UpdateRandom=1
UpdateDivider=-1
Group=Color
UniqueRandom=1

[Measure33]
Measure=Calc
Formula=Random
LowBound=0
HighBound=10000
UpdateRandom=1
UpdateDivider=-1
Group=Color
UniqueRandom=1

[MeterFacebook]
Meter = Image
ImageName=#@#logo_transparent.png
X=0
Y=0
W=128
H=128
LeftMouseUpAction=["www.facebook.com"]
ColorMatrix1=[c11]; [c12]; [c13]; 0; 0
ColorMatrix2=[c21]; [c22]; [c23]; 0; 0
ColorMatrix3=[c31]; [c32]; [c33]; [c01]; 0
ColorMatrix4=[c31]; [c32]; [c33]; [c00]; 0
SolidColor=0,0,0,1
DynamicVariables=1

[MeterValues]
Meter=STRING
MeasureName=MeasureTime
MeasureName2=c11
MeasureName3=c12
MeasureName4=c13
MeasureName5=c21
MeasureName6=c22
MeasureName7=c23
MeasureName8=c31
MeasureName9=c32
MeasureName10=c33
X=0
Y=128
Padding=15,5,15,5
FontColor=220,220,220
FontEffectColor=0,0,0
StringEffect=Shadow
SolidColor=0,0,0,150
FontSize=8
FontFace=Segoe UI
StringStyle=BOLD
StringAlign=LEFT
AntiAlias=1
Text=Time: %1#CRLF#%2; %3; %4#CRLF#%5; %6; %7#CRLF#%8; %9; %10
DynamicVariables=1
Hidden=0
NumOfDecimals=3
GIF 8.08.2022 04-45-25.gif


Deneme_1.0.rmskin


ps:I forgot to remove the notification on the meter :Whistle Delete the following line of code to remove it :thumbup:

Code: Select all

[MeterValues]
Meter=STRING
MeasureName=MeasureTime
MeasureName2=c11
MeasureName3=c12
MeasureName4=c13
MeasureName5=c21
MeasureName6=c22
MeasureName7=c23
MeasureName8=c31
MeasureName9=c32
MeasureName10=c33
X=0
Y=128
Padding=15,5,15,5
FontColor=220,220,220
FontEffectColor=0,0,0
StringEffect=Shadow
SolidColor=0,0,0,150
FontSize=8
FontFace=Segoe UI
StringStyle=BOLD
StringAlign=LEFT
AntiAlias=1
Text=Time: %1#CRLF#%2; %3; %4#CRLF#%5; %6; %7#CRLF#%8; %9; %10
DynamicVariables=1
Hidden=0
NumOfDecimals=3
thank you for helping me... you and balala solved my problem... I was really trying to do the code for a couple of days and almost tried to just give up on it but now, with your help, I can enjoy doing this for all my skins.. thank you so much... a lot
User avatar
tass_co
Posts: 513
Joined: May 4th, 2020, 3:01 pm
Location: Ankara, TURKEY

Re: setting random color and fade-out effect

Post by tass_co »

EmmJey wrote: August 9th, 2022, 7:56 am thank you for helping me... you and balala solved my problem... I was really trying to do the code for a couple of days and almost tried to just give up on it but now, with your help, I can enjoy doing this for all my skins.. thank you so much... a lot
Never give up! The Rainmeter community is always here for help :great:
I don't know where i going from here, but i promise it won't be boring... :great:
User avatar
balala
Rainmeter Sage
Posts: 16144
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: setting random color and fade-out effect

Post by balala »

EmmJey wrote: August 9th, 2022, 7:56 am thank you for helping me... you and balala solved my problem...
No, I didn't actually, at least not completely. In fact tass_co's code is much better in term os changing the color.
Question is if you still are interested into the fading effect? Because started to work on it, but I'm gonna continue only if you confirm you're still interested. So, are you?
User avatar
tass_co
Posts: 513
Joined: May 4th, 2020, 3:01 pm
Location: Ankara, TURKEY

Re: setting random color and fade-out effect

Post by tass_co »

balala wrote: August 9th, 2022, 3:17 pm Question is if you still are interested into the fading effect? Because started to work on it, but I'm gonna continue only if you confirm you're still interested. So, are you?
I want it balala
Because I had to set Update = 100 to make the fading effect soft
It would be very good if we could find a better solution
I don't know where i going from here, but i promise it won't be boring... :great:
User avatar
balala
Rainmeter Sage
Posts: 16144
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: setting random color and fade-out effect

Post by balala »

tass_co wrote: August 9th, 2022, 5:34 pm I want it balala
Because I had to set Update = 100 to make the fading effect soft
It would be very good if we could find a better solution
I'm sorry, don't want to hurt you, but in fact you had no fade effect at all in your code. The color has changed directly in your skin. It has changed, but not with an effect, but directly. In my view a fade effect means the color changing doesn't go on directly, but slowly.
For a fade effect we need either to reduce the Update value (the only advantage of such a solution is the simplicity of code, but besides this there are a lot of disadvantages, like the more powerful loading of CPU), or a much better solution is to use the default Update=1000 and use the ActionTimer plugin. This complicates a little bit the code, but it worth in my opinion.
So I rewrote the code, posting it below. Same way as previously the Period variable sets the interval between two consecutive color changing. You shouldn't change the other variables, they are needed unaltered by the skin.
So please try out the posted code and let me know what you think about it:

Code: Select all

[Rainmeter]
Update=1000

[Variables]
Period=10
Step=0
Sign=1
Current11=[&Measure111]
Current12=[&Measure121]
Current13=[&Measure131]
Current21=[&Measure211]
Current22=[&Measure221]
Current23=[&Measure231]
Current31=[&Measure311]
Current32=[&Measure321]
Current33=[&Measure331]
Upd=[!UpdateMeasureGroup "Transition"][!UpdateMeasure "MeasureFade"][!UpdateMeter "MeterValues"][!UpdateMeter "MeterFacebook"][!Redraw]

[MeasureTime]
Measure=Calc
Formula=( COUNTER % #Period# )
IfCondition=(#CURRENTSECTION#=0)
IfTrueAction=[!CommandMeasure "MeasureFade" "Execute 1"]
DynamicVariables=1

[MeasureFade]
Measure=Plugin
Plugin=ActionTimer
Group=Sliders
ActionList1=Repeat Forward,25,50 | Reset
Forward=[!SetVariable Step "(Clamp((#Step#+1),0,50))"]#Upd#
Reset=[!SetVariable Step "0"][!SetVariable Sign "(-1*#Sign#)"][!SetVariable Current11 "((#Sign#=1)?[Measure110]:[Measure111])"][!SetVariable Current12 "((#Sign#=1)?[Measure120]:[Measure121])"][!SetVariable Current13 "((#Sign#=1)?[Measure130]:[Measure131])"][!SetVariable Current21 "((#Sign#=1)?[Measure210]:[Measure211])"][!SetVariable Current22 "((#Sign#=1)?[Measure220]:[Measure221])"][!SetVariable Current23 "((#Sign#=1)?[Measure230]:[Measure231])"][!SetVariable Current31 "((#Sign#=1)?[Measure310]:[Measure311])"][!SetVariable Current32 "((#Sign#=1)?[Measure320]:[Measure321])"][!SetVariable Current33 "((#Sign#=1)?[Measure330]:[Measure331])"]#Upd#
DynamicVariables=1

[MeasureUpdate]
Measure=Calc
Formula=#Sign#
IfCondition=(#CURRENTSECTION#=1)
IfTrueAction=[!UpdateMeasureGroup "Color0"]
IfCondition2=(#CURRENTSECTION#=-1)
IfTrueAction2=[!UpdateMeasureGroup "Color1"]
DynamicVariables=1

[Measure110]
Measure=Calc
Formula=Random
LowBound=0
HighBound=10000
UpdateRandom=1
UpdateDivider=-1
Group=Color0
UniqueRandom=1

[Measure111]
Measure=Calc
Formula=Random
LowBound=0
HighBound=10000
UpdateRandom=1
UpdateDivider=-1
Group=Color1
UniqueRandom=1

[Measure120]
Measure=Calc
Formula=Random
LowBound=0
HighBound=10000
UpdateRandom=1
UpdateDivider=-1
Group=Color0
UniqueRandom=1

[Measure121]
Measure=Calc
Formula=Random
LowBound=0
HighBound=10000
UpdateRandom=1
UpdateDivider=-1
Group=Color1
UniqueRandom=1

[Measure130]
Measure=Calc
Formula=Random
LowBound=0
HighBound=10000
UpdateRandom=1
UpdateDivider=-1
Group=Color0
UniqueRandom=1

[Measure131]
Measure=Calc
Formula=Random
LowBound=0
HighBound=10000
UpdateRandom=1
UpdateDivider=-1
Group=Color1
UniqueRandom=1

[Measure210]
Measure=Calc
Formula=Random
LowBound=0
HighBound=10000
UpdateRandom=1
UpdateDivider=-1
Group=Color0
UniqueRandom=1

[Measure211]
Measure=Calc
Formula=Random
LowBound=0
HighBound=10000
UpdateRandom=1
UpdateDivider=-1
Group=Color1
UniqueRandom=1

[Measure220]
Measure=Calc
Formula=Random
LowBound=0
HighBound=10000
UpdateRandom=1
UpdateDivider=-1
Group=Color0
UniqueRandom=1

[Measure221]
Measure=Calc
Formula=Random
LowBound=0
HighBound=10000
UpdateRandom=1
UpdateDivider=-1
Group=Color1
UniqueRandom=1

[Measure230]
Measure=Calc
Formula=Random
LowBound=0
HighBound=10000
UpdateRandom=1
UpdateDivider=-1
Group=Color0
UniqueRandom=1

[Measure231]
Measure=Calc
Formula=Random
LowBound=0
HighBound=10000
UpdateRandom=1
UpdateDivider=-1
Group=Color1
UniqueRandom=1

[Measure310]
Measure=Calc
Formula=Random
LowBound=0
HighBound=10000
UpdateRandom=1
UpdateDivider=-1
Group=Color0
UniqueRandom=1

[Measure311]
Measure=Calc
Formula=Random
LowBound=0
HighBound=10000
UpdateRandom=1
UpdateDivider=-1
Group=Color1
UniqueRandom=1

[Measure320]
Measure=Calc
Formula=Random
LowBound=0
HighBound=10000
UpdateRandom=1
UpdateDivider=-1
Group=Color0
UniqueRandom=1

[Measure321]
Measure=Calc
Formula=Random
LowBound=0
HighBound=10000
UpdateRandom=1
UpdateDivider=-1
Group=Color1
UniqueRandom=1

[Measure330]
Measure=Calc
Formula=Random
LowBound=0
HighBound=10000
UpdateRandom=1
UpdateDivider=-1
Group=Color0
UniqueRandom=1

[Measure331]
Measure=Calc
Formula=Random
LowBound=0
HighBound=10000
UpdateRandom=1
UpdateDivider=-1
Group=Color1
UniqueRandom=1

[Measure11Trans]
Measure=Calc
Formula=( #Current11# + #Sign# * #Step# * (( #Step# > 0 ) && ( #Step# < 50 )) * ( Measure110 - Measure111 ) / 50 )
DynamicVariables=1
Group=Transition

[Measure12Trans]
Measure=Calc
Formula=( #Current12# + #Sign# * #Step# * (( #Step# > 0 ) && ( #Step# < 50 )) * ( Measure120 - Measure121 ) / 50 )
DynamicVariables=1
Group=Transition

[Measure13Trans]
Measure=Calc
Formula=( #Current13# + #Sign# * #Step# * (( #Step# > 0 ) && ( #Step# < 50 )) * ( Measure130 - Measure131 ) / 50 )
DynamicVariables=1
Group=Transition

[Measure21Trans]
Measure=Calc
Formula=( #Current21# + #Sign# * #Step# * (( #Step# > 0 ) && ( #Step# < 50 )) * ( Measure210 - Measure211 ) / 50 )
DynamicVariables=1
Group=Transition

[Measure22Trans]
Measure=Calc
Formula=( #Current22# + #Sign# * #Step# * (( #Step# > 0 ) && ( #Step# < 50 )) * ( Measure220 - Measure221 ) / 50 )
DynamicVariables=1
Group=Transition

[Measure23Trans]
Measure=Calc
Formula=( #Current23# + #Sign# * #Step# * (( #Step# > 0 ) && ( #Step# < 50 )) * ( Measure230 - Measure231 ) / 50 )
DynamicVariables=1
Group=Transition

[Measure31Trans]
Measure=Calc
Formula=( #Current31# + #Sign# * #Step# * (( #Step# > 0 ) && ( #Step# < 50 )) * ( Measure310 - Measure311 ) / 50 )
DynamicVariables=1
Group=Transition

[Measure32Trans]
Measure=Calc
Formula=( #Current32# + #Sign# * #Step# * (( #Step# > 0 ) && ( #Step# < 50 )) * ( Measure320 - Measure321 ) / 50 )
DynamicVariables=1
Group=Transition

[Measure33Trans]
Measure=Calc
Formula=( #Current33# + #Sign# * #Step# * (( #Step# > 0 ) && ( #Step# < 50 )) * ( Measure330 - Measure331 ) / 50 )
DynamicVariables=1
Group=Transition

[MeterFacebook]
Meter = Image
ImageName=#@#logo_transparent.png
X=0
Y=0
W=128
H=128
LeftMouseUpAction=["https://www.facebook.com/"]
ColorMatrix1=([Measure11Trans]/10000);([Measure12Trans]/10000);([Measure13Trans]/10000);0;0
ColorMatrix2=([Measure21Trans]/10000);([Measure22Trans]/10000);([Measure23Trans]/10000);0;0
ColorMatrix3=([Measure31Trans]/10000);([Measure32Trans]/10000);([Measure33Trans]/10000);0;0
SolidColor=0,0,0,1
DynamicVariables=1

[MeterValues]
Meter=STRING
MeasureName=MeasureTime
MeasureName2=Measure11Trans
MeasureName3=Measure12Trans
MeasureName4=Measure13Trans
MeasureName5=Measure21Trans
MeasureName6=Measure22Trans
MeasureName7=Measure23Trans
MeasureName8=Measure31Trans
MeasureName9=Measure32Trans
MeasureName10=Measure33Trans
X=0
Y=0
Padding=15,5,15,5
FontColor=220,220,220
FontEffectColor=0,0,0
StringEffect=Shadow
SolidColor=0,0,0,150
FontSize=8
FontFace=Segoe UI
StringStyle=BOLD
StringAlign=LEFT
AntiAlias=1
Text=Time: %1#CRLF#-----------------#CRLF#ColorMatrix:#CRLF#%2	%3	%4#CRLF#%5	%6	%7#CRLF#%8	%9	%10
Take care to have the logo_transparent.png image file into the @Resources folder (as required by the [MeterFacebook] meter).
User avatar
tass_co
Posts: 513
Joined: May 4th, 2020, 3:01 pm
Location: Ankara, TURKEY

Re: setting random color and fade-out effect

Post by tass_co »

balala wrote: August 9th, 2022, 6:55 pm in fact you had no fade effect at all in your code. The color has changed directly in your skin. It has changed, but not with an effect, but directly. In my view a fade effect means the color changing doesn't go on directly, but slowly.
For a fade effect we need either to reduce the Update value (the only advantage of such a solution is the simplicity of code, but besides this there are a lot of disadvantages, like the more powerful loading of CPU), or a much better solution is to use the default Update=1000 and use the ActionTimer plugin. This complicates a little bit the code, but it worth in my opinion.
So I rewrote the code, posting it below. Same way as previously the Period variable sets the interval between two consecutive color changing. You shouldn't change the other variables, they are needed unaltered by the skin.
So please try out the posted code and let me know what you think about it:
Please correct me if I'm wrong.
Don't we use the alpha channel for the fade effect?
Red part => 255,255,255,255
Am I right?
If so, there is no fading effect in the code you share. Because in the Colormatrix line, you only changed the values of the RGB channel.
But in fact, what you need to do should have changed the values of the Alpha channel as I did.

ColorMatrix1= Red, Green, Blue, Alpha, White
I don't know where i going from here, but i promise it won't be boring... :great:
User avatar
balala
Rainmeter Sage
Posts: 16144
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: setting random color and fade-out effect

Post by balala »

tass_co wrote: August 9th, 2022, 8:09 pm Please correct me if I'm wrong.
Don't we use the alpha channel for the fade effect?
Red part => 255,255,255,255
Am I right?
Yep and no. When we continuously want to change the color, there is no reason to use the alpha value (my opinion). Instead and especially that we had to work with the ColorMatrix options, not with color codes, I continuously modified the 3 x 3 components of the ColorMatrix options. If you check the result you'll see what am I talking about, See how the color of the image periodically switches continuously from the first color to the second one, without working with the alpha value.
I don't really see how the alpha value could be used to change the color, excepting the case when you completely fade out the first color (making it transparent), change it directly when it is invisible (transparent, with its Alpha value set to 0), then fade it back in. But this means there will be some moments when the color / image is not visible.
And can't really say how could this be done with ColorMatrix.
So no, in my opinion we can't work with the alpha value in this case. Please let me know if I'm missing something.
User avatar
tass_co
Posts: 513
Joined: May 4th, 2020, 3:01 pm
Location: Ankara, TURKEY

Re: setting random color and fade-out effect

Post by tass_co »

First of all, you know me. My English is not good enough.
Because of this, I am writing late and cannot express myself fully. I am sorry for this
balala wrote: August 9th, 2022, 8:20 pm When we continuously want to change the color, there is no reason to use the alpha value (my opinion). Instead and especially that we had to work with the ColorMatrix options, not with color codes, I continuously modified the 3 x 3 components of the ColorMatrix options. If you check the result you'll see what am I talking about, See how the color of the image periodically switches continuously from the first color to the second one, without working with the alpha value.
I looked at your code. You are right.
However, we're talking about so many different things :)
You are talked about the color transition effect.
I'm talking about the fade out effect.
Anyway, I'm not extending it.

If we added a fadeout effect to this code, it would be excatly what EmmJey wanted :thumbup:

Thank you balala :great:
I don't know where i going from here, but i promise it won't be boring... :great:
User avatar
balala
Rainmeter Sage
Posts: 16144
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: setting random color and fade-out effect

Post by balala »

tass_co wrote: August 9th, 2022, 9:48 pm First of all, you know me. My English is not good enough.
Because of this, I am writing late and cannot express myself fully. I am sorry for this
Same here, unfortunately...
tass_co wrote: August 9th, 2022, 9:48 pm I looked at your code. You are right.
However, we're talking about so many different things :)
You are talked about the color transition effect.
I'm talking about the fade out effect.
Yep, as said, strictly speaking you are perfectly right. However in my opinion, changing one color to another doesn't have to imply the alpha value. Changing the red, green and blue values of the first color to the red, green and blue values of the second one is better, because we don1t have to alter the transparency of colors. In this case obviously we had to change the appropriate terms of the ColorMatrix options, but this in fact can be done with the same technique like changing the color components.
However I'm still waiting for EmmJey to tell us / me if this is looking as what you wanted to get.