It is currently March 28th, 2024, 7:58 pm

New here and to RainMeter

Introduce yourself to the Rainmeter community!
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: New here and to RainMeter

Post by jsmorley »

Here is an example of transitioning a color between white and blue. Let me know if you need any explanations of what is going on.

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1

[Variables]
TargetRed=119
TargetGreen=182
TargetBlue=255

Red1=255
Green1=255
Blue1=255
Trans1=255

U=[!UpdateMeasure TransitionColor][!UpdateMeter *][!Redraw]

[MeterString1]
Meter=String
FontSize=25
FontWeight=400
FontColor=#Red1#,#Green1#,#Blue1#,#Trans1#
SolidColor=0,0,0,1
AntiAlias=1
DynamicVariables=1
Text=Hello World
MouseOverAction=[!CommandMeasure TransitionColor "Stop 2"][!CommandMeasure TransitionColor "Execute 1"]
MouseLeaveAction=[!CommandMeasure TransitionColor "Stop 1"][!CommandMeasure TransitionColor "Execute 2"]

[TransitionColor]
Measure=Plugin
Plugin=ActionTimer
ActionList1=Repeat Move1ToBlue,10,20
Move1ToBlue=[!SetVariable Red1 "(Clamp(#Red1#-7,#TargetRed#,255))"][!SetVariable Green1 "(Clamp(#Green1#-7,#TargetGreen#,255))"]#U#
ActionList2=Repeat Move1ToWhite,10,20
Move1ToWhite=[!SetVariable Red1 "(Clamp(#Red1#+7,#TargetRed#,255))"][!SetVariable Green1 "(Clamp(#Green1#+7,#TargetGreen#,255))"]#U#
DynamicVariables=1
GIF.gif

As I said, colors are a bit tricky, as depending on what you are moving "to" and "from" , you will need to transition one or more of red/green/blue, and it may be that some need to increase, and others decrease to get there. The function Clamp() is useful so you don't have to exactly hit the target value, just overrun it a bit.

https://docs.rainmeter.net/manual/mouse-actions/
https://docs.rainmeter.net/manual/plugins/actiontimer/
https://docs.rainmeter.net/manual/formulas/#Functions
You do not have the required permissions to view the files attached to this post.
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: New here and to RainMeter

Post by jsmorley »

You can use the About / Skins panel to watch the values change as you move the mouse.

GIF2.gif
You do not have the required permissions to view the files attached to this post.
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: New here and to RainMeter

Post by balala »

Christer wrote: October 27th, 2018, 1:41 pm Been reading a bit about transitions, but do i have to create a transition.lua file and link that into launcher.ini, or could I make transition styling inside the launcher.ini ? https://forum.rainmeter.net/viewtopic.php?t=12953
Beside jsmorley's sample code, I agree with him, saying that for such things the ActionTimer plugin is the best. Where you would like to use the transition? My tip would be you want to use a fade effect when you're hovering the mouse over the Launcher string in Launcher2.ini, but am i right? Please give a few details, because what I said is easy to be achieved.
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: New here and to RainMeter

Post by jsmorley »

Other kinds of transitions are basically variants on this approach, you just need to change W/H/FontSize to alter sizes, and X/Y to alter position.
Christer
Posts: 11
Joined: October 25th, 2018, 1:10 pm
Location: Norway

Re: New here and to RainMeter

Post by Christer »

Aight, that helped alot! :D

But what does these do?
DynamicWindowSize=1
AccurateText=1
DynamicVariables=1
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: New here and to RainMeter

Post by jsmorley »

Christer wrote: October 27th, 2018, 3:33 pm Aight, that helped alot! :D

But what does these do?
DynamicWindowSize=1
AccurateText=1
DynamicVariables=1
The first two are part of the [Rainmeter] section.

DynamicWindowSize just tells Rainmeter to increase or decrease the size of the skin window if the meter(s) in it dynamically change in size. Not really needed for this skin, but I just put it in all my skins, so I don't have to think about it.
AccurateText tells Rainmeter to use the better font rendering provided by Direct2D, rather than using the older GDI+ approach. This is mostly in Rainmeter for backwards compatibility for older skins, and really should just always be set to "1" in any new skin you create.

DynamicVariables is a bigger topic. The long and the short of it is that if you use the value of a #Variable# or [MeasureName] that changes dynamically, as our color variables do in this skin, you must set DynamicVariables=1 where you "use" them, so the most current value is used.

https://docs.rainmeter.net/manual/skins/rainmeter-section/#DynamicWindowSize
https://docs.rainmeter.net/manual/skins/rainmeter-section/#AccurateText
https://docs.rainmeter.net/tips/dynamiccheatsheet/
Christer
Posts: 11
Joined: October 25th, 2018, 1:10 pm
Location: Norway

Re: New here and to RainMeter

Post by Christer »

Okay, thanks again for helping me :)
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: New here and to RainMeter

Post by jsmorley »

To add more things to "transition", you would need more color variables, and more "ActionList" items in the ActionTimer plugin measure.

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1

[Variables]
TargetRed=119
TargetGreen=182
TargetBlue=255

Red1=255
Green1=255
Blue1=255
Trans1=255
Red2=255
Green2=255
Blue2=255
Trans2=255

U=[!UpdateMeasure TransitionColor][!UpdateMeter *][!Redraw]

[MeterString1]
Meter=String
FontSize=25
FontWeight=400
FontColor=#Red1#,#Green1#,#Blue1#,#Trans1#
SolidColor=0,0,0,1
AntiAlias=1
DynamicVariables=1
Text=Link 1
MouseOverAction=[!CommandMeasure TransitionColor "Stop 2"][!CommandMeasure TransitionColor "Execute 1"]
MouseLeaveAction=[!CommandMeasure TransitionColor "Stop 1"][!CommandMeasure TransitionColor "Execute 2"]

[MeterString2]
Meter=String
X=10R
FontSize=25
FontWeight=400
FontColor=#Red2#,#Green2#,#Blue2#,#Trans2#
SolidColor=0,0,0,1
AntiAlias=1
DynamicVariables=1
Text=Link 2
MouseOverAction=[!CommandMeasure TransitionColor "Stop 4"][!CommandMeasure TransitionColor "Execute 3"]
MouseLeaveAction=[!CommandMeasure TransitionColor "Stop 3"][!CommandMeasure TransitionColor "Execute 4"]

[TransitionColor]
Measure=Plugin
Plugin=ActionTimer
ActionList1=Repeat Move1ToBlue,10,20
Move1ToBlue=[!SetVariable Red1 "(Clamp(#Red1#-7,#TargetRed#,255))"][!SetVariable Green1 "(Clamp(#Green1#-7,#TargetGreen#,255))"]#U#
ActionList2=Repeat Move1ToWhite,10,20
Move1ToWhite=[!SetVariable Red1 "(Clamp(#Red1#+7,#TargetRed#,255))"][!SetVariable Green1 "(Clamp(#Green1#+7,#TargetGreen#,255))"]#U#
ActionList3=Repeat Move2ToBlue,10,20
Move2ToBlue=[!SetVariable Red2 "(Clamp(#Red2#-7,#TargetRed#,255))"][!SetVariable Green2 "(Clamp(#Green2#-7,#TargetGreen#,255))"]#U#
ActionList4=Repeat Move2ToWhite,10,20
Move2ToWhite=[!SetVariable Red2 "(Clamp(#Red2#+7,#TargetRed#,255))"][!SetVariable Green2 "(Clamp(#Green2#+7,#TargetGreen#,255))"]#U#
DynamicVariables=1
GIF.gif
You do not have the required permissions to view the files attached to this post.