It is currently May 7th, 2024, 11:54 am

Image-time related | Need help!

Get help with creating, editing & fixing problems with skins
Infinia
Posts: 3
Joined: March 19th, 2012, 1:18 pm

Image-time related | Need help!

Post by Infinia »

Hi, I'm completely new to Rainmeter so pardon me for my uber newbness.

I'm trying to develop a skin that will change its tint according to the current time. However, I have no clue how I'm supposed to do that.
How can I assign my [CalcTint] measure to the ImageTint=(<CalcTint> should represent either R/G/B) in my meter?

Here are the related parts in the code:-

Code: Select all

[MeasureHour]
Measure=Time
Format=%#H

[CalcTint]
Measure=Calc
Formula=(MeasureHour*11)

[MeterBackgroundRed]
Meter=Image
ImageName=redmoon.png
ImageTint=(0, [CalcTint], 0, 255)
W=115
H=115
AntiAlias=1
Also, is it possible to include an image that moves in a single direction also based on the current time? Eg. A square that moves from a starting position on the left to an ending position on the right which repeats itself on an hourly basis.

Any help would be appreciated! Thanks! :D
User avatar
jsmorley
Developer
Posts: 22631
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Image-time related | Need help!

Post by jsmorley »

I don't think ImageTint is going to get you where you want. If you use ImageTint=[SomeColor],0,0,255 all the green and blue pixels will turn black, and the image will sorta fade from a solid black mass to a red tinted image as [SomeColor] increases from 0 to 255. If you use ImageTint=[SomeColor],255,255,255 you will get an image that is a turquoise color (full green and blue mixed) with more red value added as [SomeColor] increases from 0 to 255. This will never tint the image "red", but only go from no red to the original image colors. ImageTint "adds" to the existing color values, and since you can't have ImageTint=[SomeColor],ignore,ignore,255 I don't think we can get the effect you want.

However, there is another tool in Rainmeter that I think will get us there. That is to use "ColorMatrix". I have done a very brute force example to show how to turn seconds into a tinting of an image with red, you can change the Time measure to hours and divide by 24 instead of 60 to get your hourly change. I just wanted something I could watch happen.

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1

[MeasureSeconds]
Measure=Time
Format=%#S

[MeasureTint]
Measure=Calc
Formula=(MeasureSeconds / 60)

[MeterMoon]
Meter=Image
ImageName=Images\RedMoon.png
ColorMatrix1=1; 0; 0; 0; 0
ColorMatrix2=0; 1; 0; 0; 0
ColorMatrix3=0; 0; 1; 0; 0
ColorMatrix4=0; 0; 0; 1; 0
ColorMatrix5=[MeasureTint]; 0; 0; 0; 1
DynamicVariables=1
This simply takes the percentage that the current second is from the total of 60, and "adds" that percentage value to the red component of the image, while leaving the green and blue alone.

It is critical that you read the information here http://rainmeter.net/cms/Meters-Image_beta and here http://rainmeter.net/cms/Tips-ColorMatrixUnleased to see what is going on. I am NO expert on ColorMatrix, and you, or perhaps someone already more familiar with it can wade in here to demonstrate how to properly use brightness / contrast / saturation to get a more pleasing effect... I started to mess with that and when a single drop of blood dripped out of my left ear, I gave up on it.
Infinia
Posts: 3
Joined: March 19th, 2012, 1:18 pm

Re: Image-time related | Need help!

Post by Infinia »

jsmorley wrote:I don't think ImageTint is going to get you where you want. If you use ImageTint=[SomeColor],0,0,255 all the green and blue pixels will turn black, and the image will sorta fade from a solid black mass to a red tinted image as [SomeColor] increases from 0 to 255. If you use ImageTint=[SomeColor],255,255,255 you will get an image that is a turquoise color (full green and blue mixed) with more red value added as [SomeColor] increases from 0 to 255. This will never tint the image "red", but only go from no red to the original image colors. ImageTint "adds" to the existing color values, and since you can't have ImageTint=[SomeColor],ignore,ignore,255 I don't think we can get the effect you want.

However, there is another tool in Rainmeter that I think will get us there. That is to use "ColorMatrix". I have done a very brute force example to show how to turn seconds into a tinting of an image with red, you can change the Time measure to hours and divide by 24 instead of 60 to get your hourly change. I just wanted something I could watch happen.

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1

[MeasureSeconds]
Measure=Time
Format=%#S

[MeasureTint]
Measure=Calc
Formula=(MeasureSeconds / 60)

[MeterMoon]
Meter=Image
ImageName=Images\RedMoon.png
ColorMatrix1=1; 0; 0; 0; 0
ColorMatrix2=0; 1; 0; 0; 0
ColorMatrix3=0; 0; 1; 0; 0
ColorMatrix4=0; 0; 0; 1; 0
ColorMatrix5=[MeasureTint]; 0; 0; 0; 1
DynamicVariables=1
This simply takes the percentage that the current second is from the total of 60, and "adds" that percentage value to the red component of the image, while leaving the green and blue alone.

It is critical that you read the information here http://rainmeter.net/cms/Meters-Image_beta and here http://rainmeter.net/cms/Tips-ColorMatrixUnleased to see what is going on. I am NO expert on ColorMatrix, and you, or perhaps someone already more familiar with it can wade in here to demonstrate how to properly use brightness / contrast / saturation to get a more pleasing effect... I started to mess with that and when a single drop of blood dripped out of my left ear, I gave up on it.

Thanks lots! The method you introduced works, but now I'm trying to configure it to brighten to brightest at 30 seconds and darken to original again at the 60th second so that there's a smooth transition of colors every minute.

I tried this:-

Code: Select all

[MeasureSeconds]
Measure=Time
Format=%#S
IfAboveValue=29
IfAboveAction=!SetOption MeterEclipse ColorMatrix5 [MeasureTintEnd]; 0; 0; 0; 1
IfBelowValue=30
IfBelowAction=!SetOption MeterEclipse ColorMatrix5 [MeasureTintStart]; 0; 0; 0; 1

[MeasureTintStart]
Measure=Calc
Formula=(MeasureSeconds / 30)

[MeasureTintEnd]
Measure=Calc
Formula=((60-MeasureSeconds) / 30)

[MeterEclipse]
Meter=Image
ImageName=moon.png
ColorMatrix1=1; 0; 0; 0; 0
ColorMatrix2=0; 1; 0; 0; 0
ColorMatrix3=0; 0; 1; 0; 0
ColorMatrix4=0; 0; 0; 1; 0
ColorMatrix5=[MeasureTintStart]; 0; 0; 0; 1
DynamicVariables=1
It works for the first 30 seconds, but the !bang doesn't seem to change it after that. The Rainmeter Log gave me "Bang: Config "0"; not found".

What's wrong this time round? :???:

*Edit*
I've read through http://rainmeter.net/cms/Tips-!SetOptionGuide and so it has something to do with the (Config)? What's supposed to be placed inside it?

Code: Select all

!SetOption [Meter/Measure] [Option] [Value] (Config)
User avatar
jsmorley
Developer
Posts: 22631
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Image-time related | Need help!

Post by jsmorley »

Code: Select all

[MeasureSeconds]
Measure=Time
Format=%#S
IfAboveValue=29
IfAboveAction=!SetOption MeterEclipse ColorMatrix5 """[MeasureTintEnd]; 0; 0; 0; 1"""
IfBelowValue=30
IfBelowAction=!SetOption MeterEclipse ColorMatrix5 """[MeasureTintStart]; 0; 0; 0; 1"""
The problem is the white space in the value you are assigning to ColorMatrix5 in the bang. If you use the quoting method above, it will fix that issue.
Infinia
Posts: 3
Joined: March 19th, 2012, 1:18 pm

Re: Image-time related | Need help!

Post by Infinia »

jsmorley wrote:

Code: Select all

[MeasureSeconds]
Measure=Time
Format=%#S
IfAboveValue=29
IfAboveAction=!SetOption MeterEclipse ColorMatrix5 """[MeasureTintEnd]; 0; 0; 0; 1"""
IfBelowValue=30
IfBelowAction=!SetOption MeterEclipse ColorMatrix5 """[MeasureTintStart]; 0; 0; 0; 1"""
The problem is the white space in the value you are assigning to ColorMatrix5 in the bang. If you use the quoting method above, it will fix that issue.
Ah, I see! I thought of that, except I tried using brackets () (which obviously didn't work).

So I've editted my code but it seems that it only changes to a static red color after the 30th second... and doesn't change to any other colors after that. No errors on the log. Logical error? :oops:
User avatar
jsmorley
Developer
Posts: 22631
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Image-time related | Need help!

Post by jsmorley »

What are you trying to have it do?
User avatar
jsmorley
Developer
Posts: 22631
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Image-time related | Need help!

Post by jsmorley »

Code: Select all

[MeasureSeconds]
Measure=Time
Format=%#S
IfAboveValue=29
IfAboveAction=!SetOption MeterEclipse ColorMatrix5 """[*MeasureTintEnd*]; 0; 0; 0; 1"""
IfBelowValue=30
IfBelowAction=!SetOption MeterEclipse ColorMatrix5 """[*MeasureTintStart*]; 0; 0; 0; 1"""
One thing I see is that when you use !SetOption with a [MeasureName] as you are, it will set the value of the option to the current value of [MeasureName]. Since this is being done in an IfxxxAction statement, that only "fires" when the value changes from false to true, only one value is being passed to the ColorMatrix5 every 30 seconds. Basically Red on / Red off.

If however you use the "*" char inside the brackets when you pass the measure, it will instead pass the literal string value of "[MeasureName]" to the option, which will change the ColorMatrix5 setting from [MeasureTintEnd]; 0; 0; 0; 1 to [MeasureTintStart]; 0; 0; 0; 1 every 30 seconds. Since the meter is "dynamic", this will cause it to transition in the way I suspect you want.

With both #VarName# and [MeasureName], if you want to use them in a !Bang, you have two choices.

If you use !SetOption SomeMeter SomeSetting "[MeasureName]" or !SetOption SomeMeter SomeSetting "#VarName#" it will set the option to the current value of either the measure or variable.

If you use !SetOption SomeMeter SomeSetting "[*MeasureName*]" or !SetOption SomeMeter SomeSetting "#*VarName*#" it will set the option to the literal strings "[MeasureName]" or "#VarName#". The "*" char is used as an "escape" to tell Rainmeter you don't want the item "resolved", but just used as is.

Sorry you are having to go on a "Bring me a rock. No, that's not the right rock, bring me another rock" hunt for these solutions. This business of "magic quotes" and "escaping values" in the context of !Bangs is not well documented. I will see about improving that today.