It is currently April 19th, 2024, 8:13 pm

Help: Switching wallpapers with a button

Get help with creating, editing & fixing problems with skins
Mino_el_Nukenin
Posts: 231
Joined: April 24th, 2020, 7:39 pm
Location: France

Re: Help: Switching wallpapers with a button

Post by Mino_el_Nukenin »

Code: Select all

[Variables]
@include=#@#\Config.inc
CenterX=80
CenterY=80
RadiusX=79
StartX=0-(10/2)+(2/2)
StartY=80
EndX=80
EndY=0+(10/2)+(2/2)
RadiusX=80-#StartX#
RadiusY=80-#StartY#



[MeterShapes]
Meter=Shape
Shape=Ellipse #CenterX#,#CenterY#,#RadiusX# | Fill Color 363640 | StrokeWidth 2 | Stroke Color 255,255,255
Shape2=Arc #StartX#,#StartY#,#EndX#,#EndY#,#RadiusX#,#RadiusY#,0,0,0,0 | StrokeWidth 10 | Stroke Color 255,0,0
AntiAlias=1
Done that, it's not good.
I'm totally confused and lost with numbers now and how the arc work; like why there are 2 points for the start and 2 for the end?. I'm getting crazy !
User avatar
Yincognito
Rainmeter Sage
Posts: 7128
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Help: Switching wallpapers with a button

Post by Yincognito »

Mino_el_Nukenin wrote: May 12th, 2020, 9:52 pmJust realized how the arc shape works. It's actually expanding in and out of the ellipse line. I thought it was only expanding out of it. I'm so confused now... :o
I'm actually confused about what you mean by this...
Any shape stroke is drawn both inwards and outwards of the "shape path". It's actually quite logical this way: imagine you're drawing something with a marker - a circle, a rectangle, whatever. The shape you're drawing will be painted on both "sides" of the marker's tip / top, according to the marker's thickness.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
Yincognito
Rainmeter Sage
Posts: 7128
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Help: Switching wallpapers with a button

Post by Yincognito »

Mino_el_Nukenin wrote: May 12th, 2020, 10:08 pm

Code: Select all

[Variables]
@include=#@#\Config.inc
CenterX=80
CenterY=80
RadiusX=79
StartX=0-(10/2)+(2/2)
StartY=80
EndX=80
EndY=0+(10/2)+(2/2)
RadiusX=80-#StartX#
RadiusY=80-#StartY#



[MeterShapes]
Meter=Shape
Shape=Ellipse #CenterX#,#CenterY#,#RadiusX# | Fill Color 363640 | StrokeWidth 2 | Stroke Color 255,255,255
Shape2=Arc #StartX#,#StartY#,#EndX#,#EndY#,#RadiusX#,#RadiusY#,0,0,0,0 | StrokeWidth 10 | Stroke Color 255,0,0
AntiAlias=1
Done that, it's not good.
I'm totally confused and lost with numbers now and how the arc work; like why there are 2 points for the start and 2 for the end?. I'm getting crazy !
It's not about the arc here - it's about the fact that you probably calculated things the wrong way. So, before I share my code that does what you want (and more), what exactly are you trying to do here? What angles are we talking about, if any?
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
Mino_el_Nukenin
Posts: 231
Joined: April 24th, 2020, 7:39 pm
Location: France

Re: Help: Switching wallpapers with a button

Post by Mino_el_Nukenin »

Yincognito wrote: May 12th, 2020, 10:12 pm I'm actually confused about what you mean by this...
Any shape stroke is drawn both inwards and outwards of the "shape path". It's actually quite logical this way: imagine you're drawing something with a marker - a circle, a rectangle, whatever. The shape you're drawing will be painted on both "sides" of the marker's tip / top, according to the marker's thickness.
Yes right, I just thought the start of the thickness width (here the strokewidth) would be at the bottom of it not in the middle. That would ease the positionning.
So I placed the arc and choose the strokewidth thinking the width of the stroke would actually start for the point I choose and expand out of it.
Mino_el_Nukenin
Posts: 231
Joined: April 24th, 2020, 7:39 pm
Location: France

Re: Help: Switching wallpapers with a button

Post by Mino_el_Nukenin »

Yincognito wrote: May 12th, 2020, 10:18 pm It's not about the arc here - it's about the fact that you probably calculated things the wrong way. So, before I share my code that does what you want (and more), what exactly are you trying to do here? What angles are we talking about, if any?
Well I was trying, definitively badly, to create the variables that would control the shape. No angle, since I got lost into this arc shape confusion.
User avatar
Yincognito
Rainmeter Sage
Posts: 7128
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Help: Switching wallpapers with a button

Post by Yincognito »

Mino_el_Nukenin wrote: May 12th, 2020, 10:23 pm Well I was trying, definitively badly, to create the variables that would control the shape. No angle, since I got lost into this arc shape confusion.
Oh, I see. You just approached this the wrong way, no big deal. You only have to compute the arc's radius(es) in the [Variables] section, as everything else (i.e. Start/End X/Y) will be calculated by the (sin() and cos() powered) formulas in the Shape2 option.

Computing the arc's radius(es) in relation to the ellipse's one(s) is very easy, as you don't have to think about the angle. Just picture them at 0 degrees on the circle, or, if it's easier to understand, horizontally. Think of it like in the schematic below (I chose 3 as the stroke width of the ellipse and 15 as the stroke width of the arc, as it was easier when talking about characters):

        arc & ellipse radiuses
<----------------------------->------->
+                          |       +       | + |
                                   AW       EW
EW = Ellipse Width
AW = Arc Width
+ = Center of the ellipse / arc and the Centers of the ellipse / arc strokes

Basically, you know everything in the schematic above, except the arc radius. This is what you have to find out.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
Mino_el_Nukenin
Posts: 231
Joined: April 24th, 2020, 7:39 pm
Location: France

Re: Help: Switching wallpapers with a button

Post by Mino_el_Nukenin »

Yincognito wrote: May 12th, 2020, 10:46 pm Oh, I see. You just approached this the wrong way, no big deal. You only have to compute the arc's radius(es) in the [Variables] section, as everything else will be calculated by the (sin() and cos() powered) formulas in the Shape2 option.

Computing the arc's radius(es) in relation to the ellipse's one(s) is very easy, as you don't have to think about the angle. Just picture them at 0 degrees on the circle, or, if it's easier to understand, horizontally. Think of it like in the schematic below (I chose 3 as the stroke width of the ellipse and 15 as the stroke width of the arc, as it was easier when talking about characters):

        arc & ellipse radiuses
<----------------------------->------->
+                          |       +       | + |
                                   AW       EW
EW = Ellipse Width
AW = Arc Width
+ = Center of the ellipse / arc and the Centers of the ellipse / arc strokes

Basically, you know everything in the schematic above, except the arc radius. This is what you have to find out.
Okay, i'm getting to understand it better. With a schematic, i'm not gonna lie, it's way more easy to understand.
I understood how the arc width is defined.

Not sure I got the angle part, since every new shape will be relative to the precedent, with just some pixels in between.

EDIT : something I'm tryign to understand : where is the origin of all of this. It's at the bottom-left, right ? If not how come the Y are positive ?
User avatar
Yincognito
Rainmeter Sage
Posts: 7128
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Help: Switching wallpapers with a button

Post by Yincognito »

Mino_el_Nukenin wrote: May 12th, 2020, 10:54 pmOkay, i'm getting to understand it better. With a schematic, i'm not gonna lie, it's way more easy to understand.
Yeah, well, that's why they say that an image is worth a thousand words... :D
Mino_el_Nukenin wrote: May 12th, 2020, 10:54 pmNot sure I got the angle part, since every new shape will be relative to the precedent, with just some pixels in between.
Ok, I'll spare you of the effort (again, LOL), and just serve you everything on a plate (just cause I'm such a nice guy and I like your projects visually, don't get it to your head... :p ).

The code - it's not as complicated as the mix of variables and formulas make it look like:

Code: Select all

[Variables]
EllipseFillColor=0,0,0,255
EllipseStrokeColor=255,255,255,255
ArcStrokeColor=255,0,0,255

EllipseStrokeW=2
EllipseCenterX=90
EllipseCenterY=90
EllipseRadiusX=89
EllipseRadiusY=89
ArcStrokeW=15
ArcCenterX=(#EllipseCenterX#)
ArcCenterY=(#EllipseCenterY#)
ArcRadiusX=(#EllipseRadiusX#-#EllipseStrokeW#/2-#ArcStrokeW#/2)
ArcRadiusY=(#EllipseRadiusY#-#EllipseStrokeW#/2-#ArcStrokeW#/2)
ArcAngleStart=60
ArcAngleEnd=240
ArcSweepDirection=1

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

---Meters---

[MeterShapes]
Meter=Shape
Shape=Ellipse #EllipseCenterX#,#EllipseCenterY#,#EllipseRadiusX#,#EllipseRadiusY# | Fill Color #EllipseFillColor# | StrokeWidth #EllipseStrokeW# | Stroke Color #EllipseStrokeColor#
Shape2=Arc (#ArcCenterX#+#ArcRadiusX#*Cos(Rad(#ArcAngleStart#))),(#ArcCenterY#+(1-2*#ArcSweepDirection#)*#ArcRadiusY#*Sin(Rad(#ArcAngleStart#))),(#ArcCenterX#+#ArcRadiusX#*Cos(Rad(#ArcAngleEnd#))),(#ArcCenterY#+(1-2*#ArcSweepDirection#)*#ArcRadiusY#*Sin(Rad(#ArcAngleEnd#))),#ArcRadiusX#,#ArcRadiusY#,360,#ArcSweepDirection#,0,0 | StrokeWidth #ArcStrokeW# | Stroke Color #ArcStrokeColor#
AntiAlias=1
Preview:
Circle &amp; Arc.jpg
Ellipse &amp; Arc.jpg
I only had to hack a little formula to take care of the arc's sweep direction, as I wanted it included in the whole thing and make everything "customizable". And yes, it works even if you set the arc radius to less, or if you want to change the sweep direction, or if you set other ellipse/arc stroke widths, or if you change the angles, or if you want the arc to "touch" an actual ellipse instead of a circle, or if you ... well, you get the point, LMAO. Just set everything from the variables and the rest will adapt to it. 8-)
You do not have the required permissions to view the files attached to this post.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
Mino_el_Nukenin
Posts: 231
Joined: April 24th, 2020, 7:39 pm
Location: France

Re: Help: Switching wallpapers with a button

Post by Mino_el_Nukenin »

Yincognito wrote: May 12th, 2020, 11:19 pm Ok, I'll spare you of the effort (again, LOL), and just serve you everything on a plate (just cause I'm such a nice guy and I like your projects visually, don't get it to your head... :p ).
Well, not really an effort, I was just lost in the numbers as I couldn't visualize it. I need to see thing...
But again, a big thanks ! It's impresive !

Now I get to paly with the numbers and see how it works (Im' getting to understand it).
I will be albe to add others arc shapes then.

I only had to hack a little formula to take care of the arc's sweep direction, as I wanted it included in the whole thing and make everything "customizable". And yes, it works even if you set the arc radius to less, or if you want to change the sweep direction, or if you set other ellipse/arc stroke widths, or if you change the angles, or if you want the arc to "touch" an actual ellipse instead of a circle, or if you ... well, you get the point, LMAO. Just set everything from the variables and the rest will adapt to it. 8-)
This is just wow !
User avatar
Yincognito
Rainmeter Sage
Posts: 7128
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Help: Switching wallpapers with a button

Post by Yincognito »

Mino_el_Nukenin wrote: May 12th, 2020, 11:35 pm Well, not really an effort, I was just lost in the numbers as I couldn't visualize it. I need to see thing...
But again, a big thanks ! It's impresive !

Now I get to paly with the numbers and see how it works (Im' getting to understand it).
I will be albe to add others arc shapes then.



This is just wow !
By the way, I knew this can be done easier ... if I'm not mistaken, this can be done using Roundline meters as well.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth