It is currently May 7th, 2024, 6:32 am

How can I use the new vector Shapes to make an analog clock skin?

Get help with creating, editing & fixing problems with skins
philmate48
Posts: 4
Joined: November 13th, 2016, 4:49 pm

How can I use the new vector Shapes to make an analog clock skin?

Post by philmate48 »

The new Shape meter is great - congratulations to the developers - but I haven't worked out how to make an analog clock skin using the new Shapes. It seems that neither the Rotator nor the Roundline meters are able to use the new Shapes. After seeing some of the brilliant examples of how the new Shapes can be used, I turned to the Loop measure, but the documentation for that is a little inaccessible for the newcomer, and anyway I couldn't find an analog clock skin that relies on it.

Can someone point me to features of Rainmeter that can be used to make an analog clock that will work using vector Shapes for the clockface and hands? Constructing the Shapes themselves isn't the problem: it's how to make the hands turn, given that the Shapes don't seem to be able to be used by Rotator or Roundline.

I'm not expecting someone to write all the code for me. Indeed, that's more than half the fun - even having to take into account that Shape Rotate uses degrees, not radians like some other features, and that there's a mixture of pixels and multiples-of-Strokewidth utilized as measurement units. But a steer in the direction of what features to explore would be greatly appreciated.

Please forgive me if I've missed something obvious: I'm a real newbie.
User avatar
jsmorley
Developer
Posts: 22631
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: How can I use the new vector Shapes to make an analog clock skin?

Post by jsmorley »

Here is the very basics of an analog clock. I didn't take the time to draw a face as such, but the hands should be accurate.

Now this is a very basic "tick tock" clock, where the minutes and seconds "jump" from one value to another. Kind of a crummy analog clock really. The hour hand is smoothed out a bit, incrementing in one minute intervals.

There is a more complicated set of formulas that treat the hours and minutes as a factor / remainder of the number of seconds in a 12-hour clock face, so you get a more graduated and smooth movement of those hands, but I can't put my finger on it right off.

This will be a good challenge for some of the math nerds here, I'm sure one of them can improve the gears and springs of this.

Balala, I'm looking at you... ;-)

But it does show how you might rotate something in a 360 degree circle, based on measure values.

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1
BackgroundMode=2
SolidColor=255,255,255,255

[MeasureSecond]
Measure=Time
Format=%#S

[MeasureSecondAngle]
Measure=Calc
Formula=MeasureSecond * 6

[MeasureMinute]
Measure=Time
Format=%#M

[MeasureMinuteAngle]
Measure=Calc
Formula=MeasureMinute * 6

[MeasureHour]
Measure=Time
Format=%#I

[MeasureHourAngle]
Measure=Calc
Formula=(MeasureHour * 30) + (MeasureMinute / 2)

[MeterShape]
Meter=Shape
X=103
Y=3
W=103
H=203
Shape=Line 0,100,0,25 | StrokeWidth 6 | Stroke Color 86,214,99,255 | StrokeEndCap Triangle | Rotate [MeasureMinuteAngle],3,75
Shape2=Line 0,100,0,50 | StrokeWidth 6 | Stroke Color 86,174,214,255 | StrokeEndCap Triangle| Rotate [MeasureHourAngle],3,50
Shape3=Line 0,100,0,0 | StrokeWidth 6 | Stroke Color 214,105,86,255 | StrokeEndCap Triangle | Rotate [MeasureSecondAngle],3,100
Shape4=Ellipse 0,100,10 | StrokeWidth 0 | Fill Color 21,63,105,255
DynamicVariables=1
GIF.gif
So I drew the hands all starting at the same center point, and drawing "up" toward 0 degrees on a compass, giving them different lengths. Then I just rotate them around that center point (the "start" of the hands) in a 359 degree arc based on the value of the hours, minutes and seconds. There is some minor tweaking you need to be careful about to account for half the StrokeWidth in positioning and such, but it's not too complicated.
You do not have the required permissions to view the files attached to this post.
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5407
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: How can I use the new vector Shapes to make an analog clock skin?

Post by eclectic-tech »

SweepSecondHandClock by jsmorley...

I understand you had a "senior" moment ;-)

This will give balala time to work some magic... :D
User avatar
jsmorley
Developer
Posts: 22631
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: How can I use the new vector Shapes to make an analog clock skin?

Post by jsmorley »

eclectic-tech wrote:SweepSecondHandClock by jsmorley...

I understand you had a "senior" moment ;-)

This will give balala time to work some magic... :D
That doesn't help as much as you might think The Rotator meter is a bit of a different animal than the Shape meter. I'm ok with the seconds "ticking", to be honest that is how it should be using a timer that only measures to the second. The minutes and hours would be better if they were a factor of the seconds though, so they move smoothly from one value to the other over time.

I think you need to use the :TimeStamp value of a time measure, then factor in the number of seconds in a 12-hour clock face, and then use some modulo % math to drive them based on that. It's just eluding me at the moment.
User avatar
jsmorley
Developer
Posts: 22631
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: How can I use the new vector Shapes to make an analog clock skin?

Post by jsmorley »

Trust me, the math is going to ramp up quite a bit when you start looking at having things "orbit" around some point rather than "rotating" around it, or moving in some defined "curve" or "arc" around the screen.

I'm looking forward to not understanding a bit of it... ;-)
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5407
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: How can I use the new vector Shapes to make an analog clock skin?

Post by eclectic-tech »

Well I thought the sweep second clock would help... :oops:

I will be right there with you trying to understand the math... :???: then :confused: and :?
User avatar
SilverAzide
Rainmeter Sage
Posts: 2618
Joined: March 23rd, 2015, 5:26 pm

Re: How can I use the new vector Shapes to make an analog clock skin?

Post by SilverAzide »

When you do figure out the math and are feeling pretty cocky ;-), take a look at the motion of the second hand on the old Windows Vista (not Win7) analog clock gadget. It "ticks" like a big old-timey wall clock, where the second hand actually overshoots and then rebounds, as if it had mass! O.O
Gadgets Wiki GitHub More Gadgets...
User avatar
jsmorley
Developer
Posts: 22631
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: How can I use the new vector Shapes to make an analog clock skin?

Post by jsmorley »

This seems to work much better:

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1

[MeasureSecond]
Measure=Time
Format=%#S

[MeasureSecondAngle]
Measure=Calc
Formula=(MeasureSecond * 6)

[MeasureMinute]
Measure=Time
Format=%#M

[MeasureMinuteAngle]
Measure=Calc
Formula=(MeasureMinute * 6) + (MeasureSecond / 60 * 6)

[MeasureHour]
Measure=Time
Format=%#I

[MeasureHourAngle]
Measure=Calc
Formula=(MeasureHour * 30) + (MeasureMinute / 60 * 30) + (MeasureSecond / 3600 * 30)

[MeterHands]
Meter=Shape
X=101
Y=1
W=101
H=201
Shape=Ellipse 0,100,90 | StrokeWidth 2 | Fill Color 247,244,178,255
Shape2=Line 0,100,0,20 | StrokeWidth 6 | Stroke Color 214,105,86,255 | StrokeEndCap Round | Rotate [MeasureSecondAngle],3,80
Shape3=Line 0,100,0,25 | StrokeWidth 6 | Stroke Color 86,214,99,255 | StrokeEndCap Round | Rotate [MeasureMinuteAngle],3,75
Shape4=Line 0,100,0,50 | StrokeWidth 6 | Stroke Color 86,174,214,255 | StrokeStartCap Round| StrokeEndCap Round | Rotate [MeasureHourAngle],3,50
Shape5=Ellipse 0,100,10 | StrokeWidth 0 | Fill Color 21,63,105,255
DynamicVariables=1
philmate48
Posts: 4
Joined: November 13th, 2016, 4:49 pm

Re: How can I use the new vector Shapes to make an analog clock skin?

Post by philmate48 »

I am gobsmacked by how rapid and helpful the replies are on this forum. Thank you so much. I now look forward to trying to get the gist of how the thing ticks ... (pun intended).

By the way, I think I prefer seeing the second hand tick in dear little quantums of time. I suspect that clocks with springs or weights and cogs and pendulums really move that way as the pendulum swings (or rotates) to and fro. I have a feeling that most so-called "analog" clocks are in reality digital in nature notwithstanding that they are presented with an analog kind of look.

Anyway, thanks again. I'll now burn the midnight oil with a little more understanding and competence and a little less clumsiness and frustration ... that is, until I run into the next impasse. Addictive, kind of like playing golf, isn't it.
User avatar
balala
Rainmeter Sage
Posts: 16201
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: How can I use the new vector Shapes to make an analog clock skin?

Post by balala »

jsmorley wrote:Balala, I'm looking at you... ;-)
eclectic-tech wrote:This will give balala time to work some magic... :D
Thanks both of you, for the trusting me.
These days I worked a lot with a new plugin, which I wrote. Practically it's ready, I'm testing it deeply, but due to this, I had no time to study the new shape meter. In fact I didn't even install the newest version of Rainmeter, so my installed software don't even support yet this new meter type. Now that I have much less work with the plugin, I'll install the latest upgrade of Rainmeter, to test the new meter. I became interested to see how it works.
Will come back a bit later...