It is currently April 19th, 2024, 6:35 pm

To create a Night/Day clock with 2 skins

Get help with creating, editing & fixing problems with skins
videorfeak
Posts: 18
Joined: February 1st, 2013, 7:25 am

To create a Night/Day clock with 2 skins

Post by videorfeak »

Hello everyone it is me again, since my last post I have mastered animated button making and have made 3 animated buttons thus far and would like to take on a new project: To create an animated clock that will display 1 animated picture during the day and a different animated picture at night.

I have been looking at bangs: http://docs.rainmeter.net/manual/bangs#Skin
and am trying to figure out which bang to use so i can make it be so at 1 am it will load the day picture and at 5pm it will load the night picture. I only have a basic coding done thus far:

Code: Select all

[Rainmeter]
Update=100

[MeasureAnimation]
Measure=CALC
Formula=Counter % (not finished)

[MeterAnimation]
Meter=Image
ImageName=#@#ImagesFrames\Frame[ImageNumberCalc].png
X= (not finished)
Y= (not finished)

[MeasureDate]
Measure=Time
Format=%A    %d.%m.%Y

[MeasureTime]
Measure=Time
Format=%H:%M:%S

[MeterDate]

[MeterTime]
If anyone has any suggestions i would be very grateful, until then i will be experimenting with stuff hoping to stumble across the right path.
Last edited by Brian on February 6th, 2013, 5:44 pm, edited 1 time in total.
Reason: Please use [code] tags.
User avatar
Mordasius
Posts: 1171
Joined: January 22nd, 2011, 4:23 pm
Location: GMT +8

Re: To create a Night/Day clock with 2 skins

Post by Mordasius »

One way to do that would be:

Code: Select all

[MeasureDayNight]
Measure=Time
Format=%H

[CalcDayNight]
Measure=Calc
Formula=MeasureDayNight+1
IfBelowValue=18
IfBelowAction=[!SetVariable DayNightImage DayTime]
IfAboveValue=17
IfAboveAction=[!SetVariable DayNightImage NightTime]

[MeterDayNightImage]
Meter=Image
ImageName=#@#Images\#DayNightImage#
DynamicVariables=1
However, I bet someone will come up with a neat little RegExpSubstitute which will do away with the need for [CalcDayNight].
videorfeak
Posts: 18
Joined: February 1st, 2013, 7:25 am

Re: To create a Night/Day clock with 2 skins

Post by videorfeak »

Thank you for your suggestion, I am currently trying to figure out how to get it to work and this is what I currently have:

Code: Select all

[Rainmeter]
Update=100

[MeasureDate]
Measure=Time
Format=%A %d.%m.%Y

[MeasureTime]
Measure=Time
Format=%H:%M:%S

[MeterDate]
MeasureName=MeasureDate
Meter=STRING
X=0
Y=80
FontColor=0,147,208
FontSize=15
FontFace=Tw Cen MT
StringStyle=NORMAL
StringEffect=NONE
AntiAlias=1
StringAlign=CENTER

[MeterTime]
MeasureName=MeasureTime
Meter=STRING
X=0
Y=100
FontColor=0,147,208
FontSize=40
FontFace=Tw Cen MT
StringStyle=NORMAL
StringEffect=NONE
AntiAlias=1
StringAlign=CENTER


[MeasureDayNight]
Measure=Time
Format=%H

[CalcDayNight]
Measure=Calc
Formula=MeasureDayNight+1
IfBelowValue=18
IfBelowAction=[!SetVariable DayNightImage DayTime]
IfAboveValue=17
IfAboveAction=[!SetVariable DayNightImage NightTime]

[MeterDayNightImage]
Meter=Image
ImageName=#@#DayNightImage\
DynamicVariables=1

[DayTime]
Meter=Image
Imagename=#@#DayTime\Frame[ImageNumberCalc].png
DynamicVariables=1

[NightTime]
Meter=Image
Imagename=#@#NightTime\Frame[ImageNumberCalc].png
DynamicVariables=1

[DayImageNumberCalc]
Measure=Calc
Formula=(ImageNumbercalc % 11) + 1

[NightImageNumberCalc]
Measure=Calc
Formula=(ImageNumbercalc % 10) + 1
As you can see i have been constantly playing with the coding trying to find the right combo, also how should I have my pictures saved? Note I have 2 sets of pictures, 1 set of 11 and 1 set of 10 and then have the coding play them in the right order instead of making 1 css with all the frames in it. I currently have the day pictures labeled Frame1, Frame2..... through 11 and the Night pictures labeled Frame12... through frame 21.

What folder path should I put them in? The usual, @Resources\folder\folder with pics or @Resources\folder\folder with 2 folders 1 day 1 night\2 folders with pics.

I have been looking into the bangs however it seems the ones i wanted to use were meant to do things to entire skins not little pieces of a skin.
Last edited by Brian on February 6th, 2013, 5:44 pm, edited 1 time in total.
Reason: Please use [code] tags.
User avatar
Mordasius
Posts: 1171
Joined: January 22nd, 2011, 4:23 pm
Location: GMT +8

Re: To create a Night/Day clock with 2 skins

Post by Mordasius »

videorfeak wrote:What folder path should I put them in? The usual, @Resources\folder\folder with pics or @Resources\folder\folder with 2 folders 1 day 1 night\2 folders with pics.
As the images have unique names I would put them all in a single folder @Resources\Images\Frames. You can them access them with a single meter such as:

Code: Select all

[DayTime]
Meter=Image
Imagename=#@#Images\Frames\Frame[ImageNumberCalc].png
DynamicVariables=1
This would show the Frame given by the value of [ImageNumberCalc]. However, you don't seem to have [ImageNumberCalc] in the code you posted so you need to put that calc measure in somewhere. I would suggest at the top with [MeasureDate] and [MeasureTime] as it is good practice to put the Measure before the Meters that display something based on the value of the Measure.

Also, you have put Update=100 in the Rainmeter section, presumably for the animation, but you don't need measures like [MeasureDate] or meters like [MeterDate] updating ten times per second. At the very least you should add UpdateDivider=10 to all the meters and measures that don't need to be updated every 100ms.

Another point is that ImageName=#@#DayNightImage\ in your [MeterDayNightImage] will never show anything because you have given a path ( @Resources\DayNightImage\ ) but no name. It needs to be something like ImageName=#@#Images\#DayNightImage# which will display @Resources\Images\DayTime.png or @Resources\Images\NightTime.png depending on the time.
User avatar
moshi
Posts: 1740
Joined: November 13th, 2012, 9:53 pm

Re: To create a Night/Day clock with 2 skins

Post by moshi »

no regular expression here, just substitute:

Code: Select all

[Counter]
Measure=Calc
;formula will depend on the number of images and speed

[DayNight]
Measure=Time
Format=%H
Substitute="00":"night","01":"day","02":"day", ... ,"17":"night", ...

[Image]
Meter=Image
ImageName="#@#images\[DayNight][Counter].png
DynamicVariables=1
so in @RESOURCES\images you would have images called day1.png, day2.png, day3.png, .... , night1.png ...
User avatar
moshi
Posts: 1740
Joined: November 13th, 2012, 9:53 pm

Re: To create a Night/Day clock with 2 skins

Post by moshi »

just an example, if the animation would have six images that change every five seconds:

Code: Select all

Measure=Calc
Formula=((FLOOR((Counter %30)/5))+1)
User avatar
Mordasius
Posts: 1171
Joined: January 22nd, 2011, 4:23 pm
Location: GMT +8

Re: To create a Night/Day clock with 2 skins

Post by Mordasius »

moshi wrote:no regular expression here, just substitute:

Code: Select all

[DayNight]
Measure=Time
Format=%H
Substitute="00":"night","01":"day","02":"day", ... ,"17":"night", ...
Just as well you came up with that because my offering of [CalcDayNight] will show midnight to 1am as daytime!

24 hour clock ends at 23:59 not 24:59 duhh.. :oops:
User avatar
moshi
Posts: 1740
Joined: November 13th, 2012, 9:53 pm

Re: To create a Night/Day clock with 2 skins

Post by moshi »

Mordasius wrote: Just as well you came up with that because my offering of [CalcDayNight] will show midnight to 1am as daytime!

24 hour clock ends at 23:59 not 24:59 duhh.. :oops:
it's weird daytime anyways ;)


personally i would use a weather or GeoNames feed to get the actual sunrise/sunset times and use these:

Code: Select all

[Variables]
Lat=
Lon=

[MeasureEvi]
Measure=Plugin
Plugin=Plugins\WebParser.dll
UpdateDivider=600
Url="http://ws.geonames.org/timezone?lat=#Lat#&lng=#Lon#"
RegExp="(?siU)(?(?=.*<countryName>).*<countryName>(.*)</countryName>)(?(?=.*<timezoneId>).*<timezoneId>(.*)</timezoneId>)(?(?=.*<time>).*<time>(.*)</time>)(?(?=.*<sunrise>).*<sunrise>.* (.*)</sunrise>)(?(?=.*<sunset>).*<sunset>.* (.*)</sunset>)"
Debug=1
StringIndex=2
DecodeCharacterReference=1
DynamicVariables=1


[MeasureEviTime]
Measure=Plugin
Plugin=Plugins\WebParser.dll
Url=[MeasureEvi]
StringIndex=3
DecodeCharacterReference=0
DynamicVariables=1
UpdateDivider=-1
RegExpSubstitute=1
Substitute="....-..-.. ":"",":":"","^$":"1200"

[MeasureEviSunrise]
Measure=Plugin
Plugin=Plugins\WebParser.dll
Url=[MeasureEvi]
StringIndex=4
DecodeCharacterReference=0
DynamicVariables=1
UpdateDivider=-1
Substitute=":":"","":"0600"

[MeasureEviSunset]
Measure=Plugin
Plugin=Plugins\WebParser.dll
Url=[MeasureEvi]
StringIndex=5
DecodeCharacterReference=0
DynamicVariables=1
UpdateDivider=-1
Substitute=":":"","":"1800"

[MeasureNight1]
Measure=Calc
Formula=([MeasureEviTime]) < ([MeasureEviSunrise]) ? 1000000 : ([MeasureEviTime])
DynamicVariables=1

[DayNight]
Measure=Calc
Formula=([MeasureNight1]) < ([MeasureEviSunset]) ? 2000000 : 1000000
Substitute="2000000":"day","1000000":"night","0":"day"
DynamicVariables=1
videorfeak
Posts: 18
Joined: February 1st, 2013, 7:25 am

Re: To create a Night/Day clock with 2 skins

Post by videorfeak »

Hello everyone thank you for all of your replies, I have tried messing around with everything y'all mentioned and I couldnt get it to work so i am currently trying a new idea, to connect the clock to the system clock via timedate.cpl plugin and this is what I have:

Code: Select all

[Rainmeter]
Update=100

[MeasureTimeDate]
measure=plugin
Plugin=timedate.cpl
UpdateDivider=10

[MeasureDayNight]
Measure=Time
Format=%H
UpdateDivider=10

[MeasureDate]
Measure=Time
Format=%A    %d.%m.%Y
UpdateDivider=10

[MeasureTime]
Measure=Time
Format=%H:%M:%S
UpdateDivider=10

[MeterDate]
MeasureName=MeasureDate
Meter=STRING
X=1080
Y=80
FontColor=0,147,208
FontSize=15
FontFace=Tw Cen MT
StringStyle=NORMAL
StringEffect=NONE
AntiAlias=1
StringAlign=CENTER
UpdateDivider=10

[MeterTime]
MeasureName=MeasureTime
Meter=STRING
X=1080
Y=100
FontColor=0,147,208
FontSize=40
FontFace=Tw Cen MT
StringStyle=NORMAL
StringEffect=NONE
AntiAlias=1
StringAlign=CENTER
UpdateDivider=10

[CalcDayNight]
Measure=Calc
Formula=MeasureDayNight+1
IfBelowValue=18
IfBelowAction=[!SetVariable DayNightImage DayTime]
IfAboveValue=17
IfAboveAction=[!SetVariable DayNightImage NightTime]
UpdateDivider=10

[ImageNumberCalc]
Measure=CALC
Formula=(ImageNumberCalc % 21) + 1

[MeterDayNightImage]
Meter=Image
ImageName=#@#ImagesFrames\#DayNightImage#
DynamicVariables=1

[DayTime]
Meter=Image
ImageName=#@#ImagesFrames\Day[ImageNumberCalc].png
DynamicVariables=1

[NightTime]
Meter=Image
ImageName=#@#ImagesFrames\Night[ImageNumberCalc].png
DynamicVariables=1
I have all my images saved in: @Resources\ImagesFrames folder labeled Day1, Day2... etc and Night1, Night2.. etc

I'm sorry to constantly keep asking for help, its just this project keeps going over my head.

Btw what I see on my screen: The text for the clock with correct time and date, then out to the left both animations flashing on and off the screen.
Last edited by Brian on February 6th, 2013, 5:45 pm, edited 1 time in total.
Reason: Please use [code] tags.
User avatar
moshi
Posts: 1740
Joined: November 13th, 2012, 9:53 pm

Re: To create a Night/Day clock with 2 skins

Post by moshi »

just try this (without anything of your code, you can add that later):

Code: Select all

[Rainmeter]
BackgroundMode=1
Update=100

[Count]
Measure=Calc
Formula=((Counter %21)+1)

[DayNight]
Measure=Time
Format=%H
Substitute="00":"night","01":"day","02":"day","03":"day","04":"day","05":"day","06":"day","07":"day","08":"day","09":"day","10":"day","11":"day","12":"day","13":"day","14":"day","15":"day","16":"day","17":"night","18":"night","19":"night","20":"night","21":"night","22":"night","23":"night"

[Image]
Meter=Image
ImageName="#@#ImagesFrames\[DayNight][Count].png"
DynamicVariables=1
i am currently trying a new idea, to connect the clock to the system clock via timedate.cpl plugin
:? forget about that. not to be rude, but this is plain nonsense.