It is currently June 16th, 2021, 12:07 pm

Is a circular meter possible?

Help with creating, editing & fixing problems with skins
User avatar
Ommichron
Posts: 5
Joined: June 9th, 2021, 5:59 am
Location: Gosport, UK

Is a circular meter possible?

Post by Ommichron »

I have just started with Rainmeter, and I may have missed something along the way (or not reached that point in my learning :D ), but I was wondering whether it is possible to make a display which is circular? I am making an analogue clock for my daughter's desktop with a background picture of our dog, and I can access the picture and make the clock work using the meter called [Background] in the code below, but I would dearly like to have the display circular, rather than have the clock hands on a square. I considered carrying out a circular crop of the picture(s), but I guess that would still leave a square on the screen?

Code: Select all

[Metadata]
Name=Rosie Clock
Author=Ommichron
Version=1.0
Information=Original code by Rainmeterbase (https://www.deviantart.com/rainmeterbase)

[Rainmeter]
Update=1000

[Background]
Meter=image
ImageName=#@#RMChesil.jpg
;ImageName=#@#RMpatio.jpg
;ImageName=#@#RMDarth.jpg
;Accesses pictures in folder called @Resources
;Use semi-colon to change background picture
w=160
h=160

[MeasureTime]
Measure=Time

[MeterMinutes]
meter=rotator
measurename=measuretime
Imagename=Images/Minute.png
;Accesses .png file in folder Images to create minute hand
x=80
y=80
startangle=6.2832
rotationangle=6.2832
valueremainder=3600
offsetx=6
offsety=64
antialias=1

[MeterHours]
meter=rotator
measurename=measuretime
Imagename=Images/Hour.png
;Accesses .png file in folder Images to create hour hand
x=80
y=80
startangle=6.2832
rotationangle=6.2832
valueremainder=43200
offsetx=6
offsety=64
antialias=1
Is this at all possible? (The simpler the better!) Thanks in advance!
User avatar
death.crafter
Posts: 176
Joined: April 24th, 2021, 8:13 pm

Re: Is a circular meter possible?

Post by death.crafter »

Ommichron wrote: ↑June 9th, 2021, 6:39 am I have just started with Rainmeter, and I may have missed something along the way (or not reached that point in my learning :D ), but I was wondering whether it is possible to make a display which is circular? I am making an analogue clock for my daughter's desktop with a background picture of our dog, and I can access the picture and make the clock work using the meter called [Background] in the code below, but I would dearly like to have the display circular, rather than have the clock hands on a square. I considered carrying out a circular crop of the picture(s), but I guess that would still leave a square on the screen?

Is this at all possible? (The simpler the better!) Thanks in advance!
The reason is really sweet. Here is a solution and a little enhancement:

Code: Select all

[Rainmeter]
Update=1000

[Variables]
DogNum=1

[BackgroundContainer]
Meter=Shape
Shape=Ellipse 80,80,80,80 | StrokeWidth 0

[Background]
Meter=image
ImageName=#@#RMDog#DogNum#.jpg
;--------------------------------------------
;I changed RMChesil to RMDog#DogNum# so that when the DogNum variable is changed
;by mouse scroll the picture will change accordingly. You have to renamre the image manually.
;--------------------------------------------
;ImageName=#@#RMChesil.jpg - Change RMChesil.jpg to RMDog1.jpg
;ImageName=#@#RMpatio.jpg - Change RMpatio.jpg to RMDog2.jpg
;ImageName=#@#RMDarth.jpg - Change RMDarth.jpg to RMDog3.jpg
;Accesses pictures in folder called @Resources
w=160
h=160

;Added this part to Background section so that she can change the picture by scrolling
;--------------------------------------------
MouseScrollDownAction=[!WriteKeyValue Variables DogNum "(#DogNum#=3 ? 1 : #DogNum#+1)"][!Refresh]
MouseScrollUpAction=[!WriteKeyValue Variables DogNum "(#DogNum#=1 ? 3 : #DogNum#-1)"][!Refresh]
;--------------------------------------------

;This part contains the image in a circle defined by the shape meter [BackgroundContainer] before this meter.
;--------------------------------------------
Container=BackgroundContainer
;--------------------------------------------

[MeasureTime]
Measure=Time

[MeterMinutes]
meter=rotator
measurename=measuretime
Imagename=Images/Minute.png
;Accesses .png file in folder Images to create minute hand
x=80
y=80
startangle=6.2832
rotationangle=6.2832
valueremainder=3600
offsetx=6
offsety=64
antialias=1

[MeterHours]
meter=rotator
measurename=measuretime
Imagename=Images/Hour.png
;Accesses .png file in folder Images to create hour hand
x=80
y=80
startangle=6.2832
rotationangle=6.2832
valueremainder=43200
offsetx=6
offsety=64
antialias=1
[/code]

Hope this helps... Come back if something didn't work out as expected. πŸ˜€
On a second note, please attach a zip file of the skin so that we can test the changes we make.
from the Realm of Death
User avatar
Ommichron
Posts: 5
Joined: June 9th, 2021, 5:59 am
Location: Gosport, UK

Re: Is a circular meter possible?

Post by Ommichron »

That is absolutely fantastic! Thank you SO much! It's made all the more precious to her because we lost our dog last September, so you have really made her day.

On a less demonstrative note ;-) , very many thanks for taking my learning a little further! Looking at the coding, am I right in thinking that I can adjust the number of images available to the scroll function by adjusting the numbers in the two lines below (and providing new, appropriately named/numbered images)? (To accommodate the pictures of the new puppy that will be arriving at the end of this month :rofl: )

Code: Select all

MouseScrollDownAction=[!WriteKeyValue Variables DogNum "(#DogNum#=3 ? 1 : #DogNum#+1)"][!Refresh]
MouseScrollUpAction=[!WriteKeyValue Variables DogNum "(#DogNum#=1 ? 3 : #DogNum#-1)"][!Refresh]
I've also attached a zip file of the .rmskin file. (I hope I did that correctly!)
You do not have the required permissions to view the files attached to this post.
User avatar
death.crafter
Posts: 176
Joined: April 24th, 2021, 8:13 pm

Re: Is a circular meter possible?

Post by death.crafter »

Ommichron wrote: ↑June 9th, 2021, 10:51 am That is absolutely fantastic! Thank you SO much! It's made all the more precious to her because we lost our dog last September, so you have really made her day.
That is sad. But I am glad I could be of help.
Ommichron wrote: ↑June 9th, 2021, 10:51 am On a less demonstrative note ;-) , very many thanks for taking my learning a little further! Looking at the coding, am I right in thinking that I can adjust the number of images available to the scroll function by adjusting the numbers in the two lines below (and providing new, appropriately named/numbered images)? (To accommodate the pictures of the new puppy that will be arriving at the end of this month :rofl: )

Code: Select all

MouseScrollDownAction=[!WriteKeyValue Variables DogNum "(#DogNum#=3 ? 1 : #DogNum#+1)"][!Refresh]
MouseScrollUpAction=[!WriteKeyValue Variables DogNum "(#DogNum#=1 ? 3 : #DogNum#-1)"][!Refresh]
Yes It is. You just have to change the number 3.
Ommichron wrote: ↑June 9th, 2021, 10:51 am I've also attached a zip file of the .rmskin file. (I hope I did that correctly!)
If you made a rmskin you could have attached that. :P
from the Realm of Death
User avatar
Ommichron
Posts: 5
Joined: June 9th, 2021, 5:59 am
Location: Gosport, UK

Re: Is a circular meter possible?

Post by Ommichron »

death.crafter wrote: ↑June 9th, 2021, 11:24 am If you made a rmskin you could have attached that. :P
:Whistle At less than 100KB I don't suppose it made any difference, but I thought it might be "protocol" for this forum!

Thanks for the confirmation, and the advice today. Much appreciated!
User avatar
balala
Rainmeter Sage
Posts: 12782
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Is a circular meter possible?

Post by balala »

Ommichron wrote: ↑June 9th, 2021, 10:51 am

Code: Select all

MouseScrollDownAction=[!WriteKeyValue Variables DogNum "(#DogNum#=3 ? 1 : #DogNum#+1)"][!Refresh]
MouseScrollUpAction=[!WriteKeyValue Variables DogNum "(#DogNum#=1 ? 3 : #DogNum#-1)"][!Refresh]
Good solution, however this requires to refresh the skin everytime you're scrolling. This is a little bit frustrating, refreshing skins is always an operation which should be seen as something better to be avoided. So instead of the above MouseScrollDownAction and MouseScrollUpAction options I'd the following ones:

Code: Select all

[Background]
...
MouseScrollDownAction=[!WriteKeyValue Variables DogNum "(#DogNum#=3?1:#DogNum#+1)"][!SetVariable DogNum "(#DogNum#=3?1:#DogNum#+1)"][!UpdateMeter "#CURRENTSECTION#"][!Redraw]
MouseScrollUpAction=[!WriteKeyValue Variables DogNum "(#DogNum#=1?3:#DogNum#-1)"][!SetVariable DogNum "(#DogNum#=1?3:#DogNum#-1)"][!UpdateMeter "#CURRENTSECTION#"][!Redraw]
DynamicVariables=1
As you can see I completely removed the [!Refresh] bangs, this time refreshing is not needed. I left the !WriteKeyValue bangs, this way the actual value of the DogNum variable is written to the [Variables] section (and this way if the skin is intentionally or accidentally refreshed, it keeps track of the last image), but also added a !SetVariable bang, to dynamically set the value of the variable. Take care that in this case the DynamicVariables=1 option becomes mandatory, it has to be added (otherwise the change won't take place). I also updated the meter and redrawn the skin (with the appropriate [!UpdateMeter "#CURRENTSECTION#"] and [!Redraw] bangs).
As said, this way you can avoid refreshing the skin. This is always preferable, the refresh is a quite destructive operation, which is good not to be used.
User avatar
Ommichron
Posts: 5
Joined: June 9th, 2021, 5:59 am
Location: Gosport, UK

Re: Is a circular meter possible?

Post by Ommichron »

Thank you for your alternative solution to my dilemma and the link to jsmorley's comment. It took me some time to understand the difference between the two solutions, and I'm still not entirely sure I fully comprehend! However, I have only been using Rainmeter for a few days, and I'm sure things will become clearer as I learn more and put into practice what I have learned.

My wife has also decided that she wants one of these clocks on her desktop, and she and my daughter are both making suggestions as to what changes now need to be made :rofl: , and I am having to remind them that it's "small steps"!
User avatar
death.crafter
Posts: 176
Joined: April 24th, 2021, 8:13 pm

Re: Is a circular meter possible?

Post by death.crafter »

Ommichron wrote: ↑June 10th, 2021, 7:15 am Thank you for your alternative solution to my dilemma and the link to jsmorley's comment. It took me some time to understand the difference between the two solutions, and I'm still not entirely sure I fully comprehend! However, I have only been using Rainmeter for a few days, and I'm sure things will become clearer as I learn more and put into practice what I have learned.

My wife has also decided that she wants one of these clocks on her desktop, and she and my daughter are both making suggestions as to what changes now need to be made :rofl: , and I am having to remind them that it's "small steps"!
WomenπŸ™ƒ

What balala told was correct in the sense of repeating the action rapidly, which can be a possibility in your case(scrolling on the clock rapidly cause it looks funny). I simply didn't consider the case. Refresh, if performed rapidly(for example with an update of 20, i.e. 50 times a second) can crash Rainmeter. So best to avoid that.

And best of luck with your future in Rainmeter. It's fun, believe me when I say it. And the best place to start is the Docs. You can get so many ideas just by looking at the options.

Regards,
death.crafter
from the Realm of Death
User avatar
Ommichron
Posts: 5
Joined: June 9th, 2021, 5:59 am
Location: Gosport, UK

Re: Is a circular meter possible?

Post by Ommichron »

WomenπŸ™ƒ
:rolmfao:
What balala told was correct in the sense of repeating the action rapidly, which can be a possibility in your case(scrolling on the clock rapidly cause it looks funny).
That could very well be the case, my daughter has cerebral palsy and uses her feet to operate her computer, which also includes a trackball with a scroll ring. She very often "over-scrolls" because of the sudden random movements. I'm sure that if there had been a problem she would have told me off :rofl: !
User avatar
balala
Rainmeter Sage
Posts: 12782
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Is a circular meter possible?

Post by balala »

Ommichron wrote: ↑June 10th, 2021, 7:15 am Thank you for your alternative solution to my dilemma and the link to jsmorley's comment. It took me some time to understand the difference between the two solutions, and I'm still not entirely sure I fully comprehend! However, I have only been using Rainmeter for a few days, and I'm sure things will become clearer as I learn more and put into practice what I have learned.

My wife has also decided that she wants one of these clocks on her desktop, and she and my daughter are both making suggestions as to what changes now need to be made :rofl: , and I am having to remind them that it's "small steps"!
Feel free anytime to come back and ask, if whatever question arises. Either related to the differences between the refresh and update, or to any other detail.
Ommichron wrote: ↑June 10th, 2021, 11:53 am That could very well be the case, my daughter has cerebral palsy and uses her feet to operate her computer, which also includes a trackball with a scroll ring. She very often "over-scrolls" because of the sudden random movements. I'm sure that if there had been a problem she would have told me off :rofl: !
Wish her all the best and health (which is most important). God help all of you.