It is currently April 26th, 2024, 9:32 pm

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

Get help with creating, editing & fixing problems with skins
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 »

balala wrote: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...
Now you are going to have to stay after class, to catch up with the other kids! ;-)
User avatar
balala
Rainmeter Sage
Posts: 16174
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:Now you are going to have to stay after class, to catch up with the other kids! ;-)
Yeah, you're right, my fault!
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 »

By the way SilverAzide, here is how you might do that "bounce" effect:

Code: Select all

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

[MeasureSecond]
Measure=Time
Format=%#S
OnChangeAction=[!CommandMeasure MeasureBounce "Reset"]

[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)

[MeasureBounce]
Measure=Loop
StartValue=0
EndValue=2
Increment=2
InvertMeasure=1
LoopCount=1

[MeterAnalogClock]
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] + [MeasureBounce]),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
GIF.gif
You do not have the required permissions to view the files attached to this post.
User avatar
balala
Rainmeter Sage
Posts: 16174
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 »

The following code is the jsmorley's clock, with smoothed movement of the hands, including the seconds hand. For this, I had to use the ActionTimer plugin, because I didn't want to decrease too much the Update value of the skin. This last parameter is set to the default 1000.
The movement of the minutes and hours hands is smoothed by jsmorley, I modified slightly his measures, then I worked only on smoothing the movement of the seconds hand. For this, I had to use a variable, named Sec, which is added to the old [MeasureSecondAngle] measure. This variable represents the variation of the angle of the seconds hand, during one second. On each update cycle, the value of this variable is cycled from 0 to 5 and it's added (as I said) to the old [MeasureSecondAngle] measure.
Please let me know how it's working and what you think.

The code:

Code: Select all

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

[Variables]
Sec=0
U=[!UpdateMeasure "MeasureSlide1"][!UpdateMeasure "MeasureSecondAngle"][!UpdateMeasure "MeasureSec"][!UpdateMeter "MeterShape"][!Redraw]

[MeasureSlide1]
Measure=Plugin
Plugin=ActionTimer
Group=Sliders
ActionList1=Repeat Left,166,6
Left=[!SetVariable Sec "(Clamp((#Sec#+1),0,6))"]#U#
DynamicVariables=1

[MeasureSec]
Measure=Calc
Formula=#Sec#
IfCondition=(MeasureSec=5)
IfTrueAction=[!SetVariable Sec "0"][!CommandMeasure MeasureSlide1 "Stop 1"][!UpdateMeasure "MeasureSlide1"]
DynamicVariables=1

[MeasureSecond]
Measure=Time
Format=%#S
OnChangeAction=[!CommandMeasure MeasureSlide1 "Execute 1"]

[MeasureSecondAngle]
Measure=Calc
Formula=( MeasureSecond * 6 + #Sec# )
DynamicVariables=1

[MeasureMinute]
Measure=Time
Format=%#M

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

[MeasureHour]
Measure=Time
Format=%#I

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

[MeterShape]
Meter=Shape
X=103
Y=3
W=103
H=203
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,35 | StrokeWidth 6 | Stroke Color 86,214,99,255 | StrokeEndCap Round | Rotate [MeasureMinuteAngle],3,65
Shape4=Line 0,100,0,50 | StrokeWidth 6 | Stroke Color 86,174,214,255 | StrokeEndCap Round | Rotate [MeasureHourAngle],3,50
Shape5=Ellipse 0,100,10 | StrokeWidth 0 | Fill Color 21,63,105,255
DynamicVariables=1
You do not have the required permissions to view the files attached to this post.
User avatar
SilverAzide
Rainmeter Sage
Posts: 2611
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 »

jsmorley wrote:By the way SilverAzide, here is how you might do that "bounce" effect:
:rofl: Haha! That's great! And you didn't even need any fancy math to do it, either. I was kind of hoping for some hyperbolic cosines or something... but this works nicely anyway.
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 »

SilverAzide wrote::rofl: Haha! That's great! And you didn't even need any fancy math to do it, either. I was kind of hoping for some hyperbolic cosines or something... but this works nicely anyway.
No Quantum Entanglement required...