It is currently March 29th, 2024, 8:37 am

Transitioning color brightness / saturation with ActionTimer and Lua

Tips and Tricks from the Rainmeter Community
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Transitioning color brightness / saturation with ActionTimer and Lua

Post by jsmorley »

Here is an example of how you might use the ActionTimer plugin in combination with some Lua to change the "brightness" or "saturation" of a given color on a mouse over / mouse leave, using a "fade" effect.
TransitionColor_1.0.rmskin
Gif1.gif
Gif2.gif
gif3.gif
gif4.gif

Code: Select all

; Set MetersToManage to the number of meters in the ActionTimer measure
; Set MouseOffColor to the RGB starting value
; Set BrightnessChange% to a positive or negative percentage of change

; Set ChangeSteps to the number of steps to take between MouseOff and MouseOver 
; Set Wait to the number of milliseconds (no less than 1) between each change
; ChangeSteps and Wait will control the speed of the transition

[Variables]
MetersToManage=4
MouseOffColor=0,139,7
BrightnessChange%=-20
ChangeSteps=15
Wait=10
The Lua is reasonably "canned", and you shouldn't have to ever change it, just control things with those variables above in the skin.
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: Transitioning color brightness / saturation with ActionTimer and Lua

Post by jsmorley »

Rather than "brightness", you might also transition the "saturation".

Code: Select all

; Set MetersToManage to the number of meters in the ActionTimer measure
; Set MouseOffColor to the RGB starting value
; Set SaturationChange% to a positive or negative percentage of change

; Set ChangeSteps to the number of steps to take between MouseOff and MouseOver
; Set Wait to the number of milliseconds (no less than 1) between each change
; ChangeSteps and Wait will control the speed of the transition

[Variables]
MetersToManage=4
MouseOffColor=99,8,0
SaturationChange%=-50
ChangeSteps=25
Wait=10
GIFa.gif
GIFb.gif
You do not have the required permissions to view the files attached to this post.