It is currently February 20th, 2020, 6:36 pm

Border around roundline

Tips and Tricks from the Rainmeter Community
mak_kawa
Posts: 499
Joined: December 30th, 2015, 9:47 am

Border around roundline

Post by mak_kawa »

Maybe someone has already written about this. But for me... I recently found the way to add border to a roundline object! See the attachment.
Image1.jpg
This is made of two roundline meters with just a same position and different colors. One has 2 more pixels on LineWidth and 1 pixel on Linelength. So, I have a border of 1 pixel width around the roundline in front of. That's all. Almost fake method, but practical enough. :-)

Code: Select all

[MeterHoursBorder]
Meter=ROUNDLINE
MeasureName=MeasureTime
W=180
H=180
X=0
Y=0
StartAngle=(Rad(270))
RotationAngle=(Rad(360))
LineWidth=7
LineStart=0
LineLength=45
LineColor=#Black#
Solid=0
AntiAlias=1
ValueRemainder=43200

[MeterHours]
Meter=ROUNDLINE
MeasureName=MeasureTime
W=180
H=180
X=0
Y=0
StartAngle=(Rad(270))
RotationAngle=(Rad(360))
LineWidth=5
LineStart=0
LineLength=44
LineColor=#PaleGold#
Solid=0
AntiAlias=1
ValueRemainder=43200
Possibly it is orthodox to achieve this with the shape meter using Rotate parameters? But, of course, I don't know how at all.
You do not have the required permissions to view the files attached to this post.
User avatar
balala
Rainmeter Sage
Posts: 9729
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Border around roundline

Post by balala »

mak_kawa wrote:Possibly it is orthodox to achieve this with the shape meter using Rotate parameters? But, of course, I don't know how at all.
Actually the Shape meters can be very well used for such purposes. I partially rewrote your code, here is the result:

Code: Select all

[Rainmeter]
Update=1000

[Variables]
HoursLength=50
MinutesLength=60
SecondsLength=70

[MeasureTime]
Measure=Time

[MeasureAngleH]
Measure=Calc
Formula=((( MeasureTime % 43200 ) / 120 ) - 90 )

[MeasureAngleM]
Measure=Calc
Formula=((( MeasureTime % 3600 ) / 10 ) - 90 )

[MeasureAngleS]
Measure=Calc
Formula=(( 6 * ( MeasureTime % 60 )) - 90 )

[MeterSeconds]
Meter=Shape
Shape=Rectangle (Max(#HoursLength#,Max(#MinutesLength#,#SecondsLength#))),(Max(#HoursLength#,Max(#MinutesLength#,#SecondsLength#))),#SecondsLength#,5 | Fill Color 255,255,255 | StrokeWidth 1 | Stroke Color 0,0,0 | Rotate [MeasureAngleS],3,3
DynamicVariables=1

[MeterMinutes]
Meter=Shape
Shape=Rectangle (Max(#HoursLength#,Max(#MinutesLength#,#SecondsLength#))),(Max(#HoursLength#,Max(#MinutesLength#,#SecondsLength#))),#MinutesLength#,5 | Fill Color 255,255,255 | StrokeWidth 1 | Stroke Color 0,0,0 | Rotate [MeasureAngleM],3,3
DynamicVariables=1

[MeterHours]
Meter=Shape
Shape=Rectangle (Max(#HoursLength#,Max(#MinutesLength#,#SecondsLength#))),(Max(#HoursLength#,Max(#MinutesLength#,#SecondsLength#))),#HoursLength#,5 | Fill Color 255,255,255 | StrokeWidth 1 | Stroke Color 0,0,0 | Rotate [MeasureAngleH],3,3
DynamicVariables=1
All of the three Calc measures ([MeasureAngleH], [MeasureAngleM] and [MeasureAngleS]) are returning an angle, in degrees. The value of each of them is used in a Shape meter, which corresponds to the appropriate hand of the clock. The length of these hands are given by the HoursLength, MinutesLength respectively SecondsLength variables, within the [Variables] section.
When I wrote the above code, I was inspired by eclectic-tech, who replied to a question of mine yesterday.

Thanks once again eclectic-tech, if you're reading this.
mak_kawa
Posts: 499
Joined: December 30th, 2015, 9:47 am

Re: Border around roundline

Post by mak_kawa »

balala, as I have said before, you are the genious of formula... It is far beyond of my skin-making ability. :-)
User avatar
balala
Rainmeter Sage
Posts: 9729
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Border around roundline

Post by balala »

mak_kawa wrote:balala, as I have said before, you are the genious of formula...
I'm glad if you think so.
However the basics behind those formulas are not too hard to be understood. In all three formulas (used in the [MeasureAngleH], [MeasureAngleM] and [MeasureAngleS] measures) the ( MeasureTime % X ) part (where X differs in each formula) represents the number of seconds passed since:
  • midnight or noon for [MeasureAngleH]
  • last entire hour for [MeasureAngleM]
  • last entire minute for [MeasureAngleS]
I had to divide / multiply the result accordingly. For example in the formula used in the [MeasureAngleH] measure, (( MeasureTime % 43200 ) / 120 ), 43200 is the number of seconds of a half day (or 12 hours). Initially the formula was ( 360 * ( MeasureTime % 43200 ) / 43200 ). (( MeasureTime % 43200 ) / 43200 ) is the percentage which passed since last midnight or noon, expressed as a number between 0 and 1. I multiplied this with 360, which is the number of degrees of a whole circle. This will give a number which is 0 at midnight and noon and goes up to 360, on 11:59:59 AM, respectively 11:59:59 PM. This is the amount of the angle which the hours hand must be rotated within 12 hours. It increases continuosly, so the hand will go around within 12 hours. I just simplified the 360 and the 43200, getting 120 in the denominator.
I did some similar calculations for other two formulas too.
And finally I extracted 90 degrees from each formula, to have the hands properly placed. With this extraction, the hands stay vertically when the appropriate number of hours, minutes or seconds is 0.
I hope I succeeded to explain what I did and you've understood it.
User avatar
jsmorley
Developer
Posts: 20269
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Border around roundline

Post by jsmorley »

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 4 | Stroke Color 21,63,105,255 | 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,6 | 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
eclectic-tech
Rainmeter Sage
Posts: 3763
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Border around roundline

Post by eclectic-tech »

balala wrote:...Thanks once again eclectic-tech, if you're reading this.
You're welcome :welcome:

You just needed a 'nudge' to start investigating the shape meter tranformers, you already knew the math involved :thumbup:

@jsmorley
"Two steps forward... one step back" ... make up your mind! ;-)
User avatar
jsmorley
Developer
Posts: 20269
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Border around roundline

Post by jsmorley »

eclectic-tech wrote: @jsmorley
"Two steps forward... one step back" ... make up your mind! ;-)
You know how it is with all those springs and gears and levers behind that skin...
User avatar
balala
Rainmeter Sage
Posts: 9729
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Border around roundline

Post by balala »

eclectic-tech wrote:You just needed a 'nudge' to start investigating the shape meter tranformers, you already knew the math involved :thumbup:
Exactly...