It is currently July 19th, 2024, 12:27 am

Round the edges of a roundline

Get help with creating, editing & fixing problems with skins
Rafamear
Posts: 114
Joined: November 15th, 2021, 1:47 am
Location: Brazil

Round the edges of a roundline

Post by Rafamear »

Basically round the edges of a roundline so they look like this:
Image

It looks like this:

Image

Code: Select all

[Rainmeter]
Update=1000
AccurateText=1

[Metadata]
Name=Mimali
Author=Rafamear
Version=1.0
License=Creative Commons Attribution-Non-Commercial-Share Alike 3.0

[Variables]
@include=#@#Variables.inc

;======================Measures=====================
;===================================================
[MeasureCPU]
Measure=CPU 
Processor=1

[MeasureTemp1]
Measure=Plugin
Plugin=CoreTemp
CoreTempType=Temperature
CoreTempIndex=(1-1)

[TranslucentSkin]
Measure=Plugin
Plugin=TranslucentRM
Type=4
Corner=2
BorderColor=ffffff1A

;=======================Shapes======================
;===================================================
[BackgroundBlur]
Meter=Shape
Shape=Rectangle 0,0,160,75,4 | Extend HolderFill | Extend HolderStroke 
HolderFill=Fill Color 245,245,245,25 
HolderStroke=Stroke Color 0,0,0,1
X=0
Y=0

[Circle]
Meter=Shape
Shape=Ellipse 26,26,24 | Extend HolderFill | Extend HolderStroke 
HolderFill=Fill Color 245,245,245
HolderStroke=Stroke Color 0,0,0,1
X=10
Y=12

[MeterCPUCircle]
Meter=Roundline
MeasureName=MeasureCPU
StartAngle=(Rad(270))
RotationAngle=(Rad(-270))
LineStart=20
LineLength=28
Solid=1
LineColor=#COLOR2#
AntiAlias=1
X=12
Y=14
W=48
H=48
Last edited by Rafamear on September 11th, 2023, 10:17 pm, edited 1 time in total.
;===========================================Rafamear=================================================
;========================= :welcome: ========== My DeviantArt ========== :Whistle ==============================
User avatar
Yincognito
Rainmeter Sage
Posts: 7742
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Round the edges of a roundline

Post by Yincognito »

The Roundline meter cannot do that by itself. You can do it though if you use a Shape meter to draw an arc and you set its stroke and end caps to Round. See the Arc Shape and Attribute Modifiers sections at
https://docs.rainmeter.net/manual/meters/shape/
The only downside would be that you'd have to use some math to determine the start and end points of the arc, since the extent of the arc is not defined as an angle, but as specific points in the meter.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
Rafamear
Posts: 114
Joined: November 15th, 2021, 1:47 am
Location: Brazil

Re: Round the edges of a roundline

Post by Rafamear »

Yincognito wrote: September 11th, 2023, 11:48 am The Roundline meter cannot do that by itself. You can do it though if you use a Shape meter to draw an arc and you set its stroke and end caps to Round. See the Arc Shape and Attribute Modifiers sections at
https://docs.rainmeter.net/manual/meters/shape/
The only downside would be that you'd have to use some math to determine the start and end points of the arc, since the extent of the arc is not defined as an angle, but as specific points in the meter.
Could I do the same using ellipse? How do I do a meter bar where I change the position of the ellipse according to the level of the bar

Code: Select all

[CircleBallProgress]
meter=Shape
Shape=Ellipse 0,([MeasureProgress]*1.5),5,5 | Fill Color #ProgressFill# | StrokeWidth 2 | Stroke Color 0,0,0,1
DynamicVariables=1
X=5r
Y=r
;===========================================Rafamear=================================================
;========================= :welcome: ========== My DeviantArt ========== :Whistle ==============================
User avatar
balala
Rainmeter Sage
Posts: 16399
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Round the edges of a roundline

Post by balala »

Rafamear wrote: September 11th, 2023, 1:31 am Basically round the edges of a roundline so they look like this:
Done. For instance:

Code: Select all

[Rainmeter]
Update=1000
SkinWidth=(2*#CenterX#)
SkinHeight=(2*#CenterY#)
BackgroundMode=2
SolidColor=220,220,220,80

[Variables]
CenterX=200
CenterY=200
Radius=100
Thickness=12
RoundlineColor=253,220,0

[MeasureCPU]
Measure=CPU
MinValue=0
MaxValue=100

[MeterShape]
Meter=Shape
X=2
Y=2
Shape=Arc #CenterX#,(#CenterY#-#Radius#),(#CenterX#+#Radius#*Sin(Rad(((Clamp((360*([MeasureCPU]/([MeasureCPU:MaxValue]-[MeasureCPU:MinValue]))),0,180)+180)%360)))),(#CenterY#+#Radius#*Cos(Rad(((Clamp((360*([MeasureCPU]/([MeasureCPU:MaxValue]-[MeasureCPU:MinValue]))),0,180)+180)%360)))),#Radius#,#Radius#,0,1,0,0 | Extend MyModifiers
Shape2=Arc (#CenterX#+#Radius#*Sin(Rad(((180+180)%360)))),(#CenterY#+#Radius#*Cos(Rad(((180+180)%360)))),(#CenterX#+#Radius#*Sin(Rad(((Clamp((360*([MeasureCPU]/([MeasureCPU:MaxValue]-[MeasureCPU:MinValue]))),180,360)+180)%360)))),(#CenterY#+#Radius#*Cos(Rad(((Clamp((360*([MeasureCPU]/([MeasureCPU:MaxValue]-[MeasureCPU:MinValue]))),180,360)+180)%360)))),#Radius#,#Radius#,0,1,0,0 | Extend MyModifiers
MyModifiers=StrokeWidth #Thickness# | Stroke Color #RoundlineColor# | Fill Color 0,0,0,0 | StrokeStartCap Round | StrokeEndCap Round
DynamicVariables=1
GIF 2023. 09. 11. 20-57-28.gif
The magic here is the StrokeEndCap Round parameter of the MyModifiers option of the [MeterShape] meter, which rounds the ends of the shape.
The meaning of the used variables:
  • CenterX and CenterY are the coordinates of the center.
  • Radius is the radius (or semidiameter) of the roundline
  • Thickness is the thickness of the line used in drawing the roundline
  • RoundlineColor is the color of roundline.
I hope the meaning of the variables are obvious. The roundline is showing the CPU usage, but you can use it to show anything else, by altering the [MeasureCPU] measure.
You do not have the required permissions to view the files attached to this post.
Rafamear
Posts: 114
Joined: November 15th, 2021, 1:47 am
Location: Brazil

Re: Round the edges of a roundline

Post by Rafamear »

balala wrote: September 11th, 2023, 6:02 pm Done. For instance:

Code: Select all

[Rainmeter]
Update=1000
SkinWidth=(2*#CenterX#)
SkinHeight=(2*#CenterY#)
BackgroundMode=2
SolidColor=220,220,220,80

[Variables]
CenterX=200
CenterY=200
Radius=100
Thickness=12
RoundlineColor=253,220,0

[MeasureCPU]
Measure=CPU
MinValue=0
MaxValue=100

[MeterShape]
Meter=Shape
X=2
Y=2
Shape=Arc #CenterX#,(#CenterY#-#Radius#),(#CenterX#+#Radius#*Sin(Rad(((Clamp((360*([MeasureCPU]/([MeasureCPU:MaxValue]-[MeasureCPU:MinValue]))),0,180)+180)%360)))),(#CenterY#+#Radius#*Cos(Rad(((Clamp((360*([MeasureCPU]/([MeasureCPU:MaxValue]-[MeasureCPU:MinValue]))),0,180)+180)%360)))),#Radius#,#Radius#,0,1,0,0 | Extend MyModifiers
Shape2=Arc (#CenterX#+#Radius#*Sin(Rad(((180+180)%360)))),(#CenterY#+#Radius#*Cos(Rad(((180+180)%360)))),(#CenterX#+#Radius#*Sin(Rad(((Clamp((360*([MeasureCPU]/([MeasureCPU:MaxValue]-[MeasureCPU:MinValue]))),180,360)+180)%360)))),(#CenterY#+#Radius#*Cos(Rad(((Clamp((360*([MeasureCPU]/([MeasureCPU:MaxValue]-[MeasureCPU:MinValue]))),180,360)+180)%360)))),#Radius#,#Radius#,0,1,0,0 | Extend MyModifiers
MyModifiers=StrokeWidth #Thickness# | Stroke Color #RoundlineColor# | Fill Color 0,0,0,0 | StrokeStartCap Round | StrokeEndCap Round
DynamicVariables=1
GIF 2023. 09. 11. 20-57-28.gif
The magic here is the StrokeEndCap Round parameter of the MyModifiers option of the [MeterShape] meter, which rounds the ends of the shape.
The meaning of the used variables:
  • CenterX and CenterY are the coordinates of the center.
  • Radius is the radius (or semidiameter) of the roundline
  • Thickness is the thickness of the line used in drawing the roundline
  • RoundlineColor is the color of roundline.
I hope the meaning of the variables are obvious. The roundline is showing the CPU usage, but you can use it to show anything else, by altering the [MeasureCPU] measure.
you saved me, I managed to use it perfectly, I don't think I could ever do it :rosegift:

and one more question, can I invert it? change its direction so that it is basically clockwise and anticlockwise
;===========================================Rafamear=================================================
;========================= :welcome: ========== My DeviantArt ========== :Whistle ==============================
User avatar
Yincognito
Rainmeter Sage
Posts: 7742
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Round the edges of a roundline

Post by Yincognito »

Rafamear wrote: September 11th, 2023, 6:48 pm I don't think I could ever do it :rosegift:
It's an application of this, more or less:
https://en.m.wikipedia.org/wiki/Unit_circle
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
balala
Rainmeter Sage
Posts: 16399
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Round the edges of a roundline

Post by balala »

Rafamear wrote: September 11th, 2023, 6:48 pm you saved me, I managed to use it perfectly, I don't think I could ever do it :rosegift:
Don't worry, if you keep working, you'll be able to do all this kind of things.
Rafamear wrote: September 11th, 2023, 6:48 pm and one more question, can I invert it? change its direction so that it is basically clockwise and anticlockwise
Yep, definitely can, but it's not obvious from the beginning how can this be done. But here is what should you do.
Alter the Shape and Shape2 options of the [MeterShape] meter, as it follows:

Code: Select all

[MeterShape]
...
Shape=Arc #CenterX#,(#CenterY#-#Radius#),(#CenterX#+#Radius#*Sin(-Rad(((Clamp((360*([MeasureCPU]/([MeasureCPU:MaxValue]-[MeasureCPU:MinValue]))),0,180)+180)%360)))),(#CenterY#+#Radius#*Cos(-Rad(((Clamp((360*([MeasureCPU]/([MeasureCPU:MaxValue]-[MeasureCPU:MinValue]))),0,180)+180)%360)))),#Radius#,#Radius#,0,0,0,0 | Extend MyModifiers
Shape2=Arc (#CenterX#+#Radius#*Sin(-Rad(((180+180)%360)))),(#CenterY#+#Radius#*Cos(-Rad(((180+180)%360)))),(#CenterX#+#Radius#*Sin(-Rad(((Clamp((360*([MeasureCPU]/([MeasureCPU:MaxValue]-[MeasureCPU:MinValue]))),180,360)+180)%360)))),(#CenterY#+#Radius#*Cos(-Rad(((Clamp((360*([MeasureCPU]/([MeasureCPU:MaxValue]-[MeasureCPU:MinValue]))),180,360)+180)%360)))),#Radius#,#Radius#,0,0,0,0 | Extend MyModifiers
...
See the added - signs in front of each Rad function and the changed 8th parameter of both Arc shape, from 1 to 0. This had to be done, to get the arches swept into the other direction, than were when an anticlockwise rotation were applied. Not sure you can follow this, it's not something obvious, but hope it does what are you expecting. Does it?
Rafamear
Posts: 114
Joined: November 15th, 2021, 1:47 am
Location: Brazil

Re: Round the edges of a roundline

Post by Rafamear »

balala wrote: September 11th, 2023, 7:39 pm Don't worry, if you keep working, you'll be able to do all this kind of things.

Yep, definitely can, but it's not obvious from the beginning how can this be done. But here is what should you do.
Alter the Shape and Shape2 options of the [MeterShape] meter, as it follows:

Code: Select all

[MeterShape]
...
Shape=Arc #CenterX#,(#CenterY#-#Radius#),(#CenterX#+#Radius#*Sin(-Rad(((Clamp((360*([MeasureCPU]/([MeasureCPU:MaxValue]-[MeasureCPU:MinValue]))),0,180)+180)%360)))),(#CenterY#+#Radius#*Cos(-Rad(((Clamp((360*([MeasureCPU]/([MeasureCPU:MaxValue]-[MeasureCPU:MinValue]))),0,180)+180)%360)))),#Radius#,#Radius#,0,0,0,0 | Extend MyModifiers
Shape2=Arc (#CenterX#+#Radius#*Sin(-Rad(((180+180)%360)))),(#CenterY#+#Radius#*Cos(-Rad(((180+180)%360)))),(#CenterX#+#Radius#*Sin(-Rad(((Clamp((360*([MeasureCPU]/([MeasureCPU:MaxValue]-[MeasureCPU:MinValue]))),180,360)+180)%360)))),(#CenterY#+#Radius#*Cos(-Rad(((Clamp((360*([MeasureCPU]/([MeasureCPU:MaxValue]-[MeasureCPU:MinValue]))),180,360)+180)%360)))),#Radius#,#Radius#,0,0,0,0 | Extend MyModifiers
...
See the added - signs in front of each Rad function and the changed 8th parameter of both Arc shape, from 1 to 0. This had to be done, to get the arches swept into the other direction, than were when an anticlockwise rotation were applied. Not sure you can follow this, it's not something obvious, but hope it does what are you expecting. Does it?
Uhh.. i kinda like this
Image

I just realized I forgot to switch to MeasureRAM, much better, and it was exactly what I was looking for
Image
;===========================================Rafamear=================================================
;========================= :welcome: ========== My DeviantArt ========== :Whistle ==============================
User avatar
balala
Rainmeter Sage
Posts: 16399
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Round the edges of a roundline

Post by balala »

Rafamear wrote: September 11th, 2023, 8:29 pm I just realized I forgot to switch to MeasureRAM, much better, and it was exactly what I was looking for
Image
Good. I'm glad!
Rafamear
Posts: 114
Joined: November 15th, 2021, 1:47 am
Location: Brazil

Re: Round the edges of a roundline

Post by Rafamear »

Oh and one more thing, I'm going to ask here, I wanted to know if there is any way to calculate the width of a text on the screen, just like I want to do here where a line will have its width according to the size of the text.

I wanted to do this because some fonts that I place change in width on the screen and the line becomes smaller or larger in relation to the text

Image
and I'm using the rectangle shape because it fits better with what I was intending

Code: Select all

[Rainmeter]
Update=1000
AccurateText=1

[Metadata]
Name=Mimali
Author=Rafamear
Version=1.0
License=Creative Commons Attribution-Non-Commercial-Share Alike 3.0

[Variables]
@include=#@#Variables.inc

;======================Measures=====================
;===================================================
[MeasureTime]
Measure=Time
Format=%H:%M

[MeasureDate]
Measure=Time
Format=%A, %b %d
FormatLocale=#Lang#

[TranslucentSkin]
Measure=Plugin
Plugin=TranslucentRM
Type=4
Corner=2
BorderColor=ffffff1A

;=======================Shapes======================
;===================================================
[BackgroundBlur]
Meter=Shape
Shape=Rectangle 0,0,330,160,4 | Extend HolderFill | Extend HolderStroke 
HolderFill=Fill Color 245,245,245,25 
HolderStroke=Stroke Color 0,0,0,1
X=0
Y=0

[Clock]
Meter=String
MeasureName=MeasureTime
X=245
Y=38
FontSize=40
FontFace=#FONT#
AntiAlias=1
FontColor=#COLOR2#
StringAlign=CenterCenter
Text="%1"

[LineClock]
Meter=Shape
Shape=Rectangle 0,0,150,8,4 | Extend HolderFill | Extend HolderStroke 
HolderFill=Fill Color #COLOR2#
HolderStroke=Stroke Color 0,0,0,1
X=170
Y=60
;===========================================Rafamear=================================================
;========================= :welcome: ========== My DeviantArt ========== :Whistle ==============================