It is currently April 19th, 2024, 7:43 am

SweepSecondClock

Clocks and timer skins
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

SweepSecondClock

Post by jsmorley »

Analog clock with a sweep second hand.
SweepSecondClock_1.0.rmskin
SweepSecondClock.png

Code: Select all

[Rainmeter]
Update=50

[Metadata]
Name=SweepSecondClock
Author=JSMorley
Information=Analog clock with sweep second hand.
License=Creative Commons Attribution-Non-Commercial-Share Alike 3.0
Version=Apr 1, 2013

[MeasureTime]
Measure=Time
AverageSize=20

[MeasureTimeCalc]
Measure=Calc
Formula=(MeasureTime%60)/60

[MeterClockFace]
Meter=Image
ImageName=#@#Images\ClockFace.png
W=100
H=100
UpdateDivider=-1

[MeterHoursHand]
Meter=Roundline
MeasureName=MeasureTime
X=0
Y=0
W=100
H=100
LineLength=26
LineColor=20,20,20,255
LineWidth=3
AntiAlias=1
StartAngle=(Rad(270))
RotationAngle=(Rad(360))
ValueRemainder=43200

[MeterMinutesHand]
Meter=Roundline
MeasureName=MeasureTime
X=0
Y=0
W=100
H=100
LineLength=35
LineColor=20,20,20,255
LineWidth=3
AntiAlias=1
StartAngle=(Rad(270))
RotationAngle=(Rad(360))
ValueRemainder=3600

[MeterSecondsHand]
Meter=Rotator
MeasureName=MeasureTimeCalc
ImageName=#@#Images\SecondsHand.png
X=0
Y=0
W=100
H=100
AntiAlias=1
OffsetX=50
OffsetY=50
StartAngle=(Rad(270))
RotationAngle=(Rad(360))
You do not have the required permissions to view the files attached to this post.
User avatar
moshi
Posts: 1740
Joined: November 13th, 2012, 9:53 pm

Re: SweepSecondClock

Post by moshi »

should be a sticky post.
User avatar
exper1mental
Posts: 269
Joined: January 9th, 2013, 7:52 pm
Location: Clemson University

Re: SweepSecondClock

Post by exper1mental »

I can't believe this isn't a sticky or something! I love how it provides a nice and simple way for the clock hands to move smoothly.
Image
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: SweepSecondClock

Post by jsmorley »

exper1mental wrote:I can't believe this isn't a sticky or something! I love how it provides a nice and simple way for the clock hands to move smoothly.
It is never going to be perfectly "smooth", but the lower you make the Update and the higher you make the AverageSize, the more "smooth" it is. The lowest possible Update is 16 (really 15.6 or some such, but Update must be an integer), so about the best you can get is:

Code: Select all

[Rainmeter]
Update=16

[Metadata]
Name=SweepSecondClock
Author=JSMorley
Information=Analog clock with sweep second hand.
License=Creative Commons Attribution-Non-Commercial-Share Alike 3.0
Version=Apr 1, 2013

[MeasureTime]
Measure=Time
AverageSize=62.5

[MeasureTimeCalc]
Measure=Calc
Formula=(MeasureTime % 60) / 60
The price you pay is that the position of the second hand will "trail" the actual value of the seconds by a little more than 1 second, due to the "averaging". When the skin is loaded or refreshed, the Time measure won't start returning a value until it get the first 16*62.5 "average", or just about one second. Generally speaking that will not matter and will be invisible, unless you for instance had a digital clock on the screen at the same time and noticed that the digital clock changed the minute while the analog clock still showed it was only 58 seconds or so. It's not in any way inaccurate or "losing" time, just "trailing" by a second or so.

The other thing you might see with an Update this low, is if your Rainmeter in general is very busy, you have a lot of skins that are updating all at once or very often, the seconds hand, which is actually based on a combination of "time" and "skin updates", might occasionally "skip" an update, and then have a very tiny jerk as it "catches up". Also probably not a big deal or very visible.

But in any case, while you can get pretty close to visibly smooth, it can't be perfect. Even if a Time measure could measure in millisecond increments, (which it can't) and you could have Update=1, (which you can't) it would still just be "tick-tick-tick-tick" instead of "tick----tick----tick----tick". It really can't ever be as smooth as a mechanical analog clock.
User avatar
exper1mental
Posts: 269
Joined: January 9th, 2013, 7:52 pm
Location: Clemson University

Re: SweepSecondClock

Post by exper1mental »

jsmorley wrote:While you can get pretty close to visibly smooth, it can't be perfect. Even if a Time measure could measure in millisecond increments, (which it can't) and you could have Update=1, (which you can't) it would still just be "tick-tick-tick-tick" instead of "tick----tick----tick----tick". It really can't ever be as smooth as a mechanical analog clock.
Yeah I noticed, I found that using Update=23 and AverageSize=60 I could get a roundline that was almost completely smooth. Even with those little issues this is an extremely handy technique.

From a performance perspective the above settings used with a roundline ate about 1-3% of my i7-3630QM's processing power. I'm betting an LUA could do same job much more efficiently, but that's another project for another day :D
Image
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: SweepSecondClock

Post by jsmorley »

exper1mental wrote: Yeah I noticed, I found that using Update=23 and AverageSize=60 I could get a roundline that was almost completely smooth. Even with those little issues this is an extremely handy technique.

From a performance perspective the above settings used with a roundline ate about 1-3% of my i7-3630QM's processing power. I'm betting an LUA could do same job much more efficiently, but that's another project for another day :D
It would be interesting to test, but to be honest I'd be surprised if you could get much more efficient or "lighter" with Lua. A simple Time measure with basically an Avg() function in C is about as "close to the bare metal" as you are likely to get, and there has to be some tiny but real overhead in handing off control to the Lua interpreter and getting a return value every 16 milliseconds.