It is currently April 24th, 2024, 7:36 pm

Help with path and CurveTo

Get help with creating, editing & fixing problems with skins
User avatar
LazieWouters
Posts: 61
Joined: August 29th, 2021, 11:11 am

Help with path and CurveTo

Post by LazieWouters »

Hi,
I'm trying to understand how to create a shape using the path and CurveTo commands. I read this documentation:
https://docs.rainmeter.net/manual/meters/shape/#Path

I tried several value changes in the code below which is given as an example to see if I could understand how CurveTo works, but I couldn't:

Code: Select all

[MeterShape2]
Meter=Shape
X=0
Y=0
Shape=Path MyPath | StrokeWidth 2 | Stroke Color 41,4,2,255 | Fill Color 87,149,212,255
MyPath=0,0 | LineTo 200,0 | ArcTo 200,100 | CurveTo 0,0,100,100
So I would like to see if someone could help me create a simple figure, this one in the image, which has three segments (point 1 is x=50px and y=150px, point 2 x=100 y=50, and point 3 x=150 y=110):
Untitled-1.png
I just need the code for the blue figure. The arrows, dots and text are just to better illustrate for you what I intend to draw on the screen.
You do not have the required permissions to view the files attached to this post.
User avatar
death.crafter
Rainmeter Sage
Posts: 1399
Joined: April 24th, 2021, 8:13 pm

Re: Help with path and CurveTo

Post by death.crafter »

LazieWouters wrote: September 2nd, 2021, 11:49 am Hi,
I'm trying to understand how to create a shape using the path and CurveTo commands. I read this documentation:
https://docs.rainmeter.net/manual/meters/shape/#Path

I tried several value changes in the code below which is given as an example to see if I could understand how CurveTo works, but I couldn't:

Code: Select all

[MeterShape2]
Meter=Shape
X=0
Y=0
Shape=Path MyPath | StrokeWidth 2 | Stroke Color 41,4,2,255 | Fill Color 87,149,212,255
MyPath=0,0 | LineTo 200,0 | ArcTo 200,100 | CurveTo 0,0,100,100
So I would like to see if someone could help me create a simple figure, this one in the image, which has three segments (point 1 is x=50px and y=150px, point 2 x=100 y=50, and point 3 x=150 y=110):
Untitled-1.png

I just need the code for the blue figure. The arrows, dots and text are just to better illustrate for you what I intend to draw on the screen.
The Curve in Shape meter is a Bezier curve, which is super hard to understand and implement unless you have a programming interface. Tho you can use two arcs and one line to implement the above graph, but I would like to know if just any arbitrary curve would do or there are other conditions for the two curves depicted.
from the Realm of Death
User avatar
LazieWouters
Posts: 61
Joined: August 29th, 2021, 11:11 am

Re: Help with path and CurveTo

Post by LazieWouters »

death.crafter wrote: September 2nd, 2021, 1:39 pm The Curve in Shape meter is a Bezier curve, which is super hard to understand and implement unless you have a programming interface. Tho you can use two arcs and one line to implement the above graph, but I would like to know if just any arbitrary curve would do or there are other conditions for the two curves depicted.
it can be an arbitrary curve, that is, as long as it is in the shape of a curve, the intensity of this curve is not relevant to me.
I'm currently using straight lines, with this code:

Code: Select all

[MeterGráficoChanceDePrecipitação]
Meter=Shape
X=0
Y=0
Shape=Path MyPath | StrokeWidth 1 | Stroke Color 255,4,2,150 | Fill Color 87,149,212,255
MyPath=180,(430-((-10)*2.8)) | LineTo 210,(430-([MeasureTempMax1]*2.8)) | LineTo 292,(430-([MeasureTempMax2]*2.8)) | LineTo 374,(430-([MeasureTempMax3]*2.8)) | LineTo 390,(430-((-10)*2.8)) | ClosePath 1
AntiAlias=1
DynamicVariables=1
The result is this, with the shape in blue. For now I'm using the maximum temperature values, just to test if it works, but then I'll change the values to show the chance of daily precipitation of rain:
Untitled-1.jpg
But with curved lines the result will be more beautiful.
You do not have the required permissions to view the files attached to this post.
User avatar
balala
Rainmeter Sage
Posts: 16168
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Help with path and CurveTo

Post by balala »

LazieWouters wrote: September 2nd, 2021, 11:49 am I just need the code for the blue figure. The arrows, dots and text are just to better illustrate for you what I intend to draw on the screen.
MyPath=50,150 | LineTo 150,110 | ArcTo 100,50,70,80,0,1,0,0 | ArcTo 50,150,70,120,0,1,0,0
User avatar
LazieWouters
Posts: 61
Joined: August 29th, 2021, 11:11 am

Re: Help with path and CurveTo

Post by LazieWouters »

balala wrote: September 2nd, 2021, 2:38 pm MyPath=50,150 | LineTo 150,110 | ArcTo 100,50,70,80,0,1,0,0 | ArcTo 50,150,70,120,0,1,0,0
Hmm, it works! let me see if I understand correctly:
does the code draw from point 1 to point 3, then from point 3 to point 2, and from point 2 to point 1?
is that so, is it drawn in reverse?
User avatar
balala
Rainmeter Sage
Posts: 16168
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Help with path and CurveTo

Post by balala »

LazieWouters wrote: September 2nd, 2021, 2:57 pm Hmm, it works! let me see if I understand correctly:
does the code draw from point 1 to point 3, then from point 3 to point 2, and from point 2 to point 1?
is that so, is it drawn in reverse?
Exactly, but in fact the order doesn't really matter: MyPath=50,150 | ArcTo 100,50,70,120,0,0,0,0 | ArcTo 150,110,70,80,0,0,0,0 | LineTo 50,150. This time the previously first arc is now the second one and vice versa: the previously second arc is now the first. This second approach has an advantage in front of my first MyPath: since the line is the last element of the path, you can draw the two arcs, then simply close the path: MyPath=50,150 | ArcTo 100,50,70,120,0,0,0,0 | ArcTo 150,110,70,80,0,0,0,0 | ClosePath 1.
User avatar
LazieWouters
Posts: 61
Joined: August 29th, 2021, 11:11 am

Re: Help with path and CurveTo

Post by LazieWouters »

balala wrote: September 2nd, 2021, 3:21 pm Exactly, but in fact the order doesn't really matter: MyPath=50,150 | ArcTo 100,50,70,120,0,0,0,0 | ArcTo 150,110,70,80,0,0,0,0 | LineTo 50,150. This time the previously first arc is now the second one and vice versa: the previously second arc is now the first. This second approach has an advantage in front of my first MyPath: since the line is the last element of the path, you can draw the two arcs, then simply close the path: MyPath=50,150 | ArcTo 100,50,70,120,0,0,0,0 | ArcTo 150,110,70,80,0,0,0,0 | ClosePath 1.
Thanks!!!
User avatar
balala
Rainmeter Sage
Posts: 16168
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Help with path and CurveTo

Post by balala »

LazieWouters wrote: September 2nd, 2021, 3:53 pm Thanks!!!
You're welcome, if I did help.