It is currently September 16th, 2024, 7:26 pm

Round the edges of a roundline

Get help with creating, editing & fixing problems with skins
User avatar
balala
Rainmeter Sage
Posts: 16549
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Round the edges of a roundline

Post by balala »

Yincognito wrote: September 12th, 2023, 6:28 pm Not sure it will have rounded corners though, despite the fact that the font does have a rounded appearance.
Possible. Can't try, because don't have the font, but most probably you're right.
ÞeSheepMan
Posts: 9
Joined: July 15th, 2024, 12:22 am

Re: Round the edges of a roundline

Post by ÞeSheepMan »

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.
Greetings, sorry to revive this post but I was using this arc graph and wanted to know how I would go about rotating the graph? It would really be nice to have it be rotated in the same way as a car's speedometer for example. Thanks!
User avatar
Yincognito
Rainmeter Sage
Posts: 8153
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Round the edges of a roundline

Post by Yincognito »

ÞeSheepMan wrote: July 15th, 2024, 12:27 am Greetings, sorry to revive this post but I was using this arc graph and wanted to know how I would go about rotating the graph? It would really be nice to have it be rotated in the same way as a car's speedometer for example. Thanks!
Well, as far as I know, apart from the circular part displaying the available speeds, a car's speedometer indicating the current speed isn't an arc but a line, and the arc displaying the available speeds isn't rotating either, the line is instead:
Image

So, given that it's not clear what you want, I'll just link each possibility:
- rotating shapes:
https://docs.rainmeter.net/manual/meters/shape/#TransformModifiers
- rotating images:
https://docs.rainmeter.net/manual/meters/rotator/
- rotating meter contents:
https://docs.rainmeter.net/manual/meters/general-options/#TransformationMatrix
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
ÞeSheepMan
Posts: 9
Joined: July 15th, 2024, 12:22 am

Re: Round the edges of a roundline

Post by ÞeSheepMan »

I mean 0% would be on the lower left bottom and 100% would be on the lower right bottom. Obviously no needle. The transformation matrix doesn't make much sense (at least for me) given that the arc lines change in size at difference percentages
User avatar
balala
Rainmeter Sage
Posts: 16549
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Round the edges of a roundline

Post by balala »

ÞeSheepMan wrote: July 15th, 2024, 12:27 am I was using this arc graph and wanted to know how I would go about rotating the graph? It would really be nice to have it be rotated in the same way as a car's speedometer for example.
So, you want to get it increasing in opposite direction, from left to right? If this is what you want, try the followings:
  • Replace the Rad functions in the Shape and Shape2 options of the [MeterShape] meter by -Rad. This way you get the arc rotating in the opposite direction.
  • Switch the SweepDirection of the same two Shape and Shape2 options, from 1 to 0. These values are the eighth values from the list of parameters of these two options.
By these updates the two mentioned options look this way:

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
MyModifiers=StrokeWidth #Thickness# | Stroke Color #RoundlineColor# | Fill Color 0,0,0,0 | StrokeStartCap Round | StrokeEndCap Round
The other options of this meter are unchanged, don't alter them.
Is this what you want to achieve? If it is, it's right, if it's not, I can't follow what you want (same way as Yincognito can't either). In this case further details are needed, please.
ÞeSheepMan
Posts: 9
Joined: July 15th, 2024, 12:22 am

Re: Round the edges of a roundline

Post by ÞeSheepMan »

This was what I was looking for, but is there anyway to start it at an angle, one the same as what 0 speed on a speedometer would be? An angle at the lower left?
User avatar
balala
Rainmeter Sage
Posts: 16549
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Round the edges of a roundline

Post by balala »

ÞeSheepMan wrote: July 15th, 2024, 9:03 pm This was what I was looking for,
I'm glad.
ÞeSheepMan wrote: July 15th, 2024, 9:03 pm but is there anyway to start it at an angle, one the same as what 0 speed on a speedometer would be? An angle at the lower left?
There are more possibilities, but now quickly the easier way I'd do this is by TransformationMatrix. If you are interested, try:
  • Adding a RotationAngle variable to the [Variables] section. For instance:

    Code: Select all

    [Variables]
    ...
    RotationAngle=135
    This is the angle in degrees, by which the shape will be rotated. Note that positive values mean anticlockwise rotation, while obviously negative values mean clockwise rotation.
  • Add the following option to the [MeterShape] meter:

    Code: Select all

    [MeterShape]
    ...
    TransformationMatrix=(Cos(Rad(#RotationAngle#)));(-1*Sin(Rad(#RotationAngle#)));(Sin(Rad(#RotationAngle#)));(Cos(Rad(#RotationAngle#)));(#CenterX#-(#CenterX#*Cos(Rad(#RotationAngle#)))-(#CenterY#*Sin(Rad(#RotationAngle#))));(#CenterY#+(#CenterX#*Sin(Rad(#RotationAngle#)))-(#CenterY#*Cos(Rad(#RotationAngle#))))
    Once again, keep the existing options, just add this one.
You can set the desired rotation angle by setting a proper value for the RotationAngle variable in the [Variables] section (first point above).
ÞeSheepMan
Posts: 9
Joined: July 15th, 2024, 12:22 am

Re: Round the edges of a roundline

Post by ÞeSheepMan »

balala wrote: July 15th, 2024, 9:22 pm I'm glad.

There are more possibilities, but now quickly the easier way I'd do this is by TransformationMatrix.
I see. While it does seem to be rotating the arc, it doesn't keep it at the point I had desired. How could I prevent it from moving? Thanks.
You do not have the required permissions to view the files attached to this post.
User avatar
balala
Rainmeter Sage
Posts: 16549
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Round the edges of a roundline

Post by balala »

ÞeSheepMan wrote: July 15th, 2024, 9:36 pm I see. While it does seem to be rotating the arc, it doesn't keep it at the point I had desired. How could I prevent it from moving? Thanks.
Not sure why is it moving. Post please the code you are using, there maybe a mistake crept in (but gonna take a look only tomorrow).
ÞeSheepMan
Posts: 9
Joined: July 15th, 2024, 12:22 am

Re: Round the edges of a roundline

Post by ÞeSheepMan »

balala wrote: July 15th, 2024, 9:47 pm Not sure why is it moving. Post please the code you are using, there maybe a mistake crept in (but gonna take a look only tomorrow).
All good if you look at this tomorrow. I forgot about my code, I did modify yours so that it only takes up ~85% of the circle (like a gauge) and moved it over to a specific point. I can't recall exactly if there was anything else, but its been a couple months since a paused on this project. This is that code:

Code: Select all

[CPUUsageGraph]
Meter=Shape
Shape=Arc 430,(173-96),(430+96*Sin(-Rad(((Clamp((307.96481*([CPUUsage]/([CPUUsage:MaxValue]-[CPUUsage:MinValue]))),0,180)+180)%360)))),(173+96*Cos(-Rad(((Clamp((307.96481*([CPUUsage]/([CPUUsage:MaxValue]-[CPUUsage:MinValue]))),0,180)+180)%360)))),96,96,0,0,0,0 | Extend MyModifiers
Shape2=Arc (430+96*Sin(-Rad(((180+180)%360)))),(173+96*Cos(-Rad(((180+180)%360)))),(430+96*Sin(-Rad(((Clamp((307.96481*([CPUUsage]/([CPUUsage:MaxValue]-[CPUUsage:MinValue]))),180,360)+180)%360)))),(173+96*Cos(-Rad(((Clamp((307.96481*([CPUUsage]/([CPUUsage:MaxValue]-[CPUUsage:MinValue]))),180,360)+180)%360)))),96,96,0,0,0,0 | Extend MyModifiers
MyModifiers=StrokeWidth 20 | Stroke Color 151, 139, 195, 255 | Fill Color 0,0,0,0 | StrokeStartCap Round | StrokeEndCap Round
TransformationMatrix=(Cos(Rad(#RotationAngle#)));(-1*Sin(Rad(#RotationAngle#)));(Sin(Rad(#RotationAngle#)));(Cos(Rad(#RotationAngle#)));(#CenterX#-(#CenterX#*Cos(Rad(#RotationAngle#)))-(#CenterY#*Sin(Rad(#RotationAngle#))));(#CenterY#+(#CenterX#*Sin(Rad(#RotationAngle#)))-(#CenterY#*Cos(Rad(#RotationAngle#))))
DynamicVariables=1