It is currently May 3rd, 2024, 5:45 am

Is it possible to use rotator with roundline?

Get help with creating, editing & fixing problems with skins
User avatar
FoxyXII
Posts: 32
Joined: October 27th, 2012, 5:58 pm
Location: SWUK

Is it possible to use rotator with roundline?

Post by FoxyXII »

Hi all,

I have been searching around and trying to work out if this is possible. I have seen many good examples of clocks which show a sweeping second hand using an image and rotator, but what I am wondering is if it's possible to create the same sweeping motion using roundline instead. I am asking this as I would like to set Solid = 1 so the arc increases in a smooth motion rather than stages.

Is this even possible?
User avatar
MerlinTheRed
Rainmeter Sage
Posts: 889
Joined: September 6th, 2011, 6:34 am

Re: Is it possible to use rotator with roundline?

Post by MerlinTheRed »

The resolution of the Time measure is one second. This means that if you just make the rotation angle dependent on a simple time measure, it will only change once a second. To make a smooth transition, you can use the AverageSize option on the Time measure, and increase the skin's update frequency.

If you set AverageSize=10 on your time measure, and make the skin update ten times per second (Update=100), the time measure will essentially report the average of the last ten values it would have reported without AverageSize set. This means you get smooth transitions between seconds because you don't display the current seconds value but rather the average value the seconds had during the last one second of skin updates. You should take care though that AverageSize*Update equals 1000 or you might get weird results. And you must do this averaging on a Time measure that reports its number value rather than the current second (0-59) because then the jump from 59 to 0 will look weird.

Here is the code for an experiment I did a while ago that uses this exact technique. it's not exactly a simple example, but you see in what way to use the Time measure together with AverageSize to get the correct result.

Code: Select all

[Rainmeter]
 DynamicWindowSize=1
 MiddleMouseUpAction=!Refresh #CURRENTCONFIG#
 Update=100

[Variables]
 LineColor=0, 0, 0, 255
 BackgroundColor=255, 255, 255, 80
 
;;====================================================
;;  Measures
;;====================================================
 
 [MeasureTime]
  Measure=Time
  AverageSize=10
  
  ; Fractions of perimeter for five 
  ; concentric circles of equal diameter
  ; 62,83 -> 0.33
  ; 50,27 -> 0.27
  ; 37,7  -> 0.2
  ; 25,13 -> 0.13
  ; 12,57 -> 0.07
  ;======
  ;188,5
  
 [MeasureSeconds1]
  Measure=Calc
  Formula=(MeasureTime%60 < 59 * 0.33) ? (MeasureTime%60/59/0.33) : 1
  MinValue=0
  MaxValue=1
  
 [MeasureSeconds2]
  Measure=Calc
  Formula=(MeasureTime%60 > 59 * 0.33 && MeasureTime%60 < 59 * (0.33+0.27)) ? ((MeasureTime%60/59-0.33)/0.27) : 1
  MinValue=0
  MaxValue=1
  
 [MeasureSeconds3]
  Measure=Calc
  Formula=(MeasureTime%60 > 59 * (0.33+0.27) && MeasureTime%60 < 59 * (0.33+0.27+0.2)) ? ((MeasureTime%60/59-0.33-0.27)/0.2) : 1
  MinValue=0
  MaxValue=1
  
 [MeasureSeconds4]
  Measure=Calc
  Formula=(MeasureTime%60 > 59 * (0.33+0.27+0.2) && MeasureTime%60 < 59 * (0.33+0.27+0.2+0.13)) ? ((MeasureTime%60/59-0.33-0.27-0.2)/0.13) : 1
  MinValue=0
  MaxValue=1
  
 [MeasureSeconds5]
  Measure=Calc
  Formula=(MeasureTime%60 > 59 * (0.33+0.27+0.2+0.13) && MeasureTime%60 < 59 * 1) ? ((MeasureTime%60/59-0.33-0.27-0.2-0.13)/0.07) : 1
  MinValue=0
  MaxValue=1

 [One]
  Measure=Calc
  Formula=1
  MinValue=0
  MaxValue=1

;;====================================================
;;  Styles
;;====================================================

 [RoundlineStyle]
 LineColor=#LineColor#
 Solid=1
 AntiAlias=1
  
;;====================================================
;;  Meters
;;====================================================
 
 [MeterBackground]
  Meter=RoundLine
  MeasureName=One
  X=0
  Y=0
  W=20
  H=20
  MeterStyle=RoundlineStyle
  LineColor=#BackgroundColor#
  LineStart=0
  LineLength=10
  
 
 [MeterSeconds1]
  Meter=RoundLine
  MeasureName=MeasureSeconds1
  X=0
  Y=0
  W=20
  H=20  
  MeterStyle=RoundlineStyle
  LineStart=7.7
  LineLength=10
  
 [MeterSeconds2]
  Meter=RoundLine
  MeasureName=MeasureSeconds2
  X=2
  Y=2
  W=16
  H=16
  MeterStyle=RoundlineStyle
  LineStart=5.7
  LineLength=8
  
 [MeterSeconds3]
  Meter=RoundLine
  MeasureName=MeasureSeconds3
  X=4
  Y=4
  W=12
  H=12
  MeterStyle=RoundlineStyle
  LineStart=3.7
  LineLength=6
  
 [MeterSeconds4]
  Meter=RoundLine
  MeasureName=MeasureSeconds4
  X=6
  Y=6
  W=8
  H=8
  MeterStyle=RoundlineStyle
  LineStart=1.7
  LineLength=4
  
 [MeterSeconds5]
  Meter=RoundLine
  MeasureName=MeasureSeconds5
  X=8
  Y=8
  W=4
  H=4
  MeterStyle=RoundlineStyle
  LineStart=0
  LineLength=2
Have more fun creating skins with Sublime Text 2 and the Rainmeter Package!
User avatar
FoxyXII
Posts: 32
Joined: October 27th, 2012, 5:58 pm
Location: SWUK

Re: Is it possible to use rotator with roundline?

Post by FoxyXII »

Thank you MerlinTheRed. I have looked at what you have shown and this is certainly what I am after, so thank you. You're right when you said it's not simple. My maths is not as good as it used to be, but I will have a play around with it and see if I can work out what does what and therefore apply it to what I am trying to achieve with my skin. Again, thanks for the help :)
User avatar
MerlinTheRed
Rainmeter Sage
Posts: 889
Joined: September 6th, 2011, 6:34 am

Re: Is it possible to use rotator with roundline?

Post by MerlinTheRed »

Actually, you don't need to understand any of the math in there. It's just so complicated to split the motion up in multiple parts. Here is a minimal example:

Code: Select all

[Rainmeter]
 Author=
 Update=100
 MiddleMouseUpAction=!Refresh #CURRENTCONFIG#

[Metadata]
 Name=Development/SmoothSeconds
 Version=0
 Information=
 License=Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported

[Variables]
 

;;====================================================
;;  Measures
;;====================================================

 [MeasureTime]
  Measure=Time
  AverageSize=10

 [MeasureTimeCalc]
  Measure=Calc
  Formula=(MeasureTime%60)/60
  MinValue=0
  MaxValue=1
 

;;====================================================
;;  Meters
;;====================================================

 [MeterRoundLine]
  Meter=RoundLine
  MeasureName=MeasureTimeCalc
  X=0
  Y=0
  W=50
  H=50
  StartAngle=(RAD(270))
  LineColor=255, 255, 255, 255
  LineWidth=1
  LineLength=25
  LineStart=21
  Solid=1
  AntiAlias=1
Have more fun creating skins with Sublime Text 2 and the Rainmeter Package!
User avatar
FoxyXII
Posts: 32
Joined: October 27th, 2012, 5:58 pm
Location: SWUK

Re: Is it possible to use rotator with roundline?

Post by FoxyXII »

That is certainly much easier to understand! I was racking my brain and getting confused with the first example. I can certainly work with this. Thank you :)