It is currently March 29th, 2024, 6:01 am

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 »

balala wrote: May 13th, 2020, 8:00 pm Have you added a DynamicVariables=1 option to that meter?
Now yes, they are moving, but not as wanted, at all ...
User avatar
Yincognito
Rainmeter Sage
Posts: 7029
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Help: Switching wallpapers with a button

Post by Yincognito »

balala wrote: May 13th, 2020, 8:00 pm Have you added a DynamicVariables=1 option to that meter?
:thumbup:
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 13th, 2020, 8:03 pm:thumbup:
Here is the whole code:

Code: Select all

[Variables]
EllipseFillColor=363640
EllipseStrokeColor=255,255,255,255
ArcStrokeColor1=d68d38
ArcStrokeColor2=a2650c
ArcStrokeColor3=e8fa82

EllipseStrokeW=2
EllipseCenterX=300
EllipseCenterY=300
EllipseRadiusX=75
EllipseRadiusY=75
ArcStrokeW1=8
ArcStrokeW2=4
ArcStrokeW3=6
ArcCenterX=(#EllipseCenterX#)
ArcCenterY=(#EllipseCenterY#)
ArcRadiusX=(#EllipseRadiusX#-#EllipseStrokeW#/2-#ArcStrokeW1#/2)
ArcRadiusY=(#EllipseRadiusY#-#EllipseStrokeW#/2-#ArcStrokeW1#/2)
ArcRadiusX2=(#EllipseRadiusX#-12)
ArcRadiusY2=(#EllipseRadiusY#-12)
ArcRadiusX3=(#EllipseRadiusX#-17)
ArcRadiusY3=(#EllipseRadiusY#-17)
ArcSweepDirection=1
--- Outer arcs ---
ArcAngleStart1=0
ArcAngleEnd1=40
ArcAngleStart2=41
ArcAngleEnd2=61
ArcAngleStart3=62
ArcAngleEnd3=102
ArcAngleStart4=103
ArcAngleEnd4=113
ArcAngleStart5=114
ArcAngleEnd5=164
ArcAngleStart6=195
ArcAngleEnd6=215
ArcAngleStart7=216
ArcAngleEnd7=236
ArcAngleStart8=237
ArcAngleEnd8=247
ArcAngleStart9=248
ArcAngleEnd9=288
ArcAngleStart10=289
ArcAngleEnd10=309
--- Inner arcs ---
ArcAngleStart11=355
ArcAngleEnd11=50
ArcAngleStart12=100
ArcAngleEnd12=110
ArcAngleStart13=111
ArcAngleEnd13=195
ArcAngleStart14=196
ArcAngleEnd14=206
ArcAngleStart15=237
ArcAngleEnd15=277
ArcAngleStart16=289
ArcAngleEnd16=329
ArcAngleStart17=330
ArcAngleEnd17=354
--- Connecting arcs ---
ArcAngleStart18=20
ArcAngleEnd18=24
ArcAngleStart19=120
ArcAngleEnd19=124
ArcAngleStart20=189
ArcAngleEnd20=193
ArcAngleStart21=199
ArcAngleEnd21=203
--- Anchors Rotation ---
AnchorX=(#EllipseCenterX#-#ArcCenterX#+#ArcRadiusX#)
AnchorY=(#EllipseCenterY#-#ArcCenterY#+#ArcRadiusY#)

===== MEASURES =====

[MeasureRotate]
Measure=Loop
StartValue=0
EndValue=359



===== METERS ========================================================
--- Circle and Rotating arcs ---

[MeterShapes]
Meter=Shape
Shape=Ellipse #EllipseCenterX#,#EllipseCenterY#,#EllipseRadiusX#,#EllipseRadiusY# | Fill Color #EllipseFillColor# | StrokeWidth #EllipseStrokeW# | Stroke Color #EllipseStrokeColor#
Shape2=Arc (#ArcCenterX#+#ArcRadiusX#*Cos(Rad(#ArcAngleStart1#))),(#ArcCenterY#+(1-2*#ArcSweepDirection#)*#ArcRadiusY#*Sin(Rad(#ArcAngleStart1#))),(#ArcCenterX#+#ArcRadiusX#*Cos(Rad(#ArcAngleEnd1#))),(#ArcCenterY#+(1-2*#ArcSweepDirection#)*#ArcRadiusY#*Sin(Rad(#ArcAngleEnd1#))),#ArcRadiusX#,#ArcRadiusY#,360,#ArcSweepDirection#,0,0 | StrokeWidth #ArcStrokeW1# | Stroke Color #ArcStrokeColor1# | Rotate [MeasureRotate],#AnchorX#,#AnchorY#
Shape3=Arc (#ArcCenterX#+#ArcRadiusX#*Cos(Rad(#ArcAngleStart2#))),(#ArcCenterY#+(1-2*#ArcSweepDirection#)*#ArcRadiusY#*Sin(Rad(#ArcAngleStart2#))),(#ArcCenterX#+#ArcRadiusX#*Cos(Rad(#ArcAngleEnd2#))),(#ArcCenterY#+(1-2*#ArcSweepDirection#)*#ArcRadiusY#*Sin(Rad(#ArcAngleEnd2#))),#ArcRadiusX#,#ArcRadiusY#,360,#ArcSweepDirection#,0,0 | StrokeWidth #ArcStrokeW1# | Stroke Color #ArcStrokeColor1# | Rotate [MeasureRotate],#AnchorX#,#AnchorY#
Shape4=Arc (#ArcCenterX#+#ArcRadiusX#*Cos(Rad(#ArcAngleStart3#))),(#ArcCenterY#+(1-2*#ArcSweepDirection#)*#ArcRadiusY#*Sin(Rad(#ArcAngleStart3#))),(#ArcCenterX#+#ArcRadiusX#*Cos(Rad(#ArcAngleEnd3#))),(#ArcCenterY#+(1-2*#ArcSweepDirection#)*#ArcRadiusY#*Sin(Rad(#ArcAngleEnd3#))),#ArcRadiusX#,#ArcRadiusY#,360,#ArcSweepDirection#,0,0 | StrokeWidth #ArcStrokeW1# | Stroke Color #ArcStrokeColor2# | Rotate [MeasureRotate],#AnchorX#,#AnchorY#
Shape5=Arc (#ArcCenterX#+#ArcRadiusX#*Cos(Rad(#ArcAngleStart4#))),(#ArcCenterY#+(1-2*#ArcSweepDirection#)*#ArcRadiusY#*Sin(Rad(#ArcAngleStart4#))),(#ArcCenterX#+#ArcRadiusX#*Cos(Rad(#ArcAngleEnd4#))),(#ArcCenterY#+(1-2*#ArcSweepDirection#)*#ArcRadiusY#*Sin(Rad(#ArcAngleEnd4#))),#ArcRadiusX#,#ArcRadiusY#,360,#ArcSweepDirection#,0,0 | StrokeWidth #ArcStrokeW1# | Stroke Color #ArcStrokeColor1# | Rotate [MeasureRotate],#AnchorX#,#AnchorY#
Shape6=Arc (#ArcCenterX#+#ArcRadiusX#*Cos(Rad(#ArcAngleStart5#))),(#ArcCenterY#+(1-2*#ArcSweepDirection#)*#ArcRadiusY#*Sin(Rad(#ArcAngleStart5#))),(#ArcCenterX#+#ArcRadiusX#*Cos(Rad(#ArcAngleEnd5#))),(#ArcCenterY#+(1-2*#ArcSweepDirection#)*#ArcRadiusY#*Sin(Rad(#ArcAngleEnd5#))),#ArcRadiusX#,#ArcRadiusY#,360,#ArcSweepDirection#,0,0 | StrokeWidth #ArcStrokeW1# | Stroke Color #ArcStrokeColor2# | Rotate [MeasureRotate],#AnchorX#,#AnchorY#
Shape7=Arc (#ArcCenterX#+#ArcRadiusX#*Cos(Rad(#ArcAngleStart6#))),(#ArcCenterY#+(1-2*#ArcSweepDirection#)*#ArcRadiusY#*Sin(Rad(#ArcAngleStart6#))),(#ArcCenterX#+#ArcRadiusX#*Cos(Rad(#ArcAngleEnd6#))),(#ArcCenterY#+(1-2*#ArcSweepDirection#)*#ArcRadiusY#*Sin(Rad(#ArcAngleEnd6#))),#ArcRadiusX#,#ArcRadiusY#,360,#ArcSweepDirection#,0,0 | StrokeWidth #ArcStrokeW1# | Stroke Color #ArcStrokeColor1# | Rotate [MeasureRotate],#AnchorX#,#AnchorY#
Shape8=Arc (#ArcCenterX#+#ArcRadiusX#*Cos(Rad(#ArcAngleStart7#))),(#ArcCenterY#+(1-2*#ArcSweepDirection#)*#ArcRadiusY#*Sin(Rad(#ArcAngleStart7#))),(#ArcCenterX#+#ArcRadiusX#*Cos(Rad(#ArcAngleEnd7#))),(#ArcCenterY#+(1-2*#ArcSweepDirection#)*#ArcRadiusY#*Sin(Rad(#ArcAngleEnd7#))),#ArcRadiusX#,#ArcRadiusY#,360,#ArcSweepDirection#,0,0 | StrokeWidth #ArcStrokeW1# | Stroke Color #ArcStrokeColor2# | Rotate [MeasureRotate],#AnchorX#,#AnchorY#
Shape9=Arc (#ArcCenterX#+#ArcRadiusX#*Cos(Rad(#ArcAngleStart8#))),(#ArcCenterY#+(1-2*#ArcSweepDirection#)*#ArcRadiusY#*Sin(Rad(#ArcAngleStart8#))),(#ArcCenterX#+#ArcRadiusX#*Cos(Rad(#ArcAngleEnd8#))),(#ArcCenterY#+(1-2*#ArcSweepDirection#)*#ArcRadiusY#*Sin(Rad(#ArcAngleEnd8#))),#ArcRadiusX#,#ArcRadiusY#,360,#ArcSweepDirection#,0,0 | StrokeWidth #ArcStrokeW1# | Stroke Color #ArcStrokeColor2# | Rotate [MeasureRotate],#AnchorX#,#AnchorY#
Shape10=Arc (#ArcCenterX#+#ArcRadiusX#*Cos(Rad(#ArcAngleStart9#))),(#ArcCenterY#+(1-2*#ArcSweepDirection#)*#ArcRadiusY#*Sin(Rad(#ArcAngleStart9#))),(#ArcCenterX#+#ArcRadiusX#*Cos(Rad(#ArcAngleEnd9#))),(#ArcCenterY#+(1-2*#ArcSweepDirection#)*#ArcRadiusY#*Sin(Rad(#ArcAngleEnd9#))),#ArcRadiusX#,#ArcRadiusY#,360,#ArcSweepDirection#,0,0 | StrokeWidth #ArcStrokeW1# | Stroke Color #ArcStrokeColor1# | Rotate [MeasureRotate],#AnchorX#,#AnchorY#
Shape11=Arc (#ArcCenterX#+#ArcRadiusX#*Cos(Rad(#ArcAngleStart10#))),(#ArcCenterY#+(1-2*#ArcSweepDirection#)*#ArcRadiusY#*Sin(Rad(#ArcAngleStart10#))),(#ArcCenterX#+#ArcRadiusX#*Cos(Rad(#ArcAngleEnd10#))),(#ArcCenterY#+(1-2*#ArcSweepDirection#)*#ArcRadiusY#*Sin(Rad(#ArcAngleEnd10#))),#ArcRadiusX#,#ArcRadiusY#,360,#ArcSweepDirection#,0,0 | StrokeWidth #ArcStrokeW1# | Stroke Color #ArcStrokeColor1# | Rotate [MeasureRotate],#AnchorX#,#AnchorY#

Shape12=Arc (#ArcCenterX#+#ArcRadiusX2#*Cos(Rad(#ArcAngleStart11#))),(#ArcCenterY#+(1-2*#ArcSweepDirection#)*#ArcRadiusY2#*Sin(Rad(#ArcAngleStart11#))),(#ArcCenterX#+#ArcRadiusX2#*Cos(Rad(#ArcAngleEnd11#))),(#ArcCenterY#+(1-2*#ArcSweepDirection#)*#ArcRadiusY2#*Sin(Rad(#ArcAngleEnd11#))),#ArcRadiusX2#,#ArcRadiusY2#,360,#ArcSweepDirection#,0,0 | StrokeWidth #ArcStrokeW2# | Stroke Color #ArcStrokeColor2#
Shape13=Arc (#ArcCenterX#+#ArcRadiusX2#*Cos(Rad(#ArcAngleStart12#))),(#ArcCenterY#+(1-2*#ArcSweepDirection#)*#ArcRadiusY2#*Sin(Rad(#ArcAngleStart12#))),(#ArcCenterX#+#ArcRadiusX2#*Cos(Rad(#ArcAngleEnd12#))),(#ArcCenterY#+(1-2*#ArcSweepDirection#)*#ArcRadiusY2#*Sin(Rad(#ArcAngleEnd12#))),#ArcRadiusX2#,#ArcRadiusY2#,360,#ArcSweepDirection#,0,0 | StrokeWidth #ArcStrokeW2# | Stroke Color #ArcStrokeColor3#
Shape14=Arc (#ArcCenterX#+#ArcRadiusX2#*Cos(Rad(#ArcAngleStart13#))),(#ArcCenterY#+(1-2*#ArcSweepDirection#)*#ArcRadiusY2#*Sin(Rad(#ArcAngleStart13#))),(#ArcCenterX#+#ArcRadiusX2#*Cos(Rad(#ArcAngleEnd13#))),(#ArcCenterY#+(1-2*#ArcSweepDirection#)*#ArcRadiusY2#*Sin(Rad(#ArcAngleEnd13#))),#ArcRadiusX2#,#ArcRadiusY2#,360,#ArcSweepDirection#,0,0 | StrokeWidth #ArcStrokeW2# | Stroke Color #ArcStrokeColor2#
Shape15=Arc (#ArcCenterX#+#ArcRadiusX2#*Cos(Rad(#ArcAngleStart14#))),(#ArcCenterY#+(1-2*#ArcSweepDirection#)*#ArcRadiusY2#*Sin(Rad(#ArcAngleStart14#))),(#ArcCenterX#+#ArcRadiusX2#*Cos(Rad(#ArcAngleEnd14#))),(#ArcCenterY#+(1-2*#ArcSweepDirection#)*#ArcRadiusY2#*Sin(Rad(#ArcAngleEnd14#))),#ArcRadiusX2#,#ArcRadiusY2#,360,#ArcSweepDirection#,0,0 | StrokeWidth #ArcStrokeW2# | Stroke Color #ArcStrokeColor3#
Shape16=Arc (#ArcCenterX#+#ArcRadiusX2#*Cos(Rad(#ArcAngleStart15#))),(#ArcCenterY#+(1-2*#ArcSweepDirection#)*#ArcRadiusY2#*Sin(Rad(#ArcAngleStart15#))),(#ArcCenterX#+#ArcRadiusX2#*Cos(Rad(#ArcAngleEnd15#))),(#ArcCenterY#+(1-2*#ArcSweepDirection#)*#ArcRadiusY2#*Sin(Rad(#ArcAngleEnd15#))),#ArcRadiusX2#,#ArcRadiusY2#,360,#ArcSweepDirection#,0,0 | StrokeWidth #ArcStrokeW2# | Stroke Color #ArcStrokeColor3#
Shape17=Arc (#ArcCenterX#+#ArcRadiusX2#*Cos(Rad(#ArcAngleStart16#))),(#ArcCenterY#+(1-2*#ArcSweepDirection#)*#ArcRadiusY2#*Sin(Rad(#ArcAngleStart16#))),(#ArcCenterX#+#ArcRadiusX2#*Cos(Rad(#ArcAngleEnd16#))),(#ArcCenterY#+(1-2*#ArcSweepDirection#)*#ArcRadiusY2#*Sin(Rad(#ArcAngleEnd16#))),#ArcRadiusX2#,#ArcRadiusY2#,360,#ArcSweepDirection#,0,0 | StrokeWidth #ArcStrokeW2# | Stroke Color #ArcStrokeColor2#
Shape18=Arc (#ArcCenterX#+#ArcRadiusX2#*Cos(Rad(#ArcAngleStart17#))),(#ArcCenterY#+(1-2*#ArcSweepDirection#)*#ArcRadiusY2#*Sin(Rad(#ArcAngleStart17#))),(#ArcCenterX#+#ArcRadiusX2#*Cos(Rad(#ArcAngleEnd17#))),(#ArcCenterY#+(1-2*#ArcSweepDirection#)*#ArcRadiusY2#*Sin(Rad(#ArcAngleEnd17#))),#ArcRadiusX2#,#ArcRadiusY2#,360,#ArcSweepDirection#,0,0 | StrokeWidth #ArcStrokeW2# | Stroke Color #ArcStrokeColor3#

Shape19=Arc (#ArcCenterX#+#ArcRadiusX3#*Cos(Rad(#ArcAngleStart18#))),(#ArcCenterY#+(1-2*#ArcSweepDirection#)*#ArcRadiusY3#*Sin(Rad(#ArcAngleStart18#))),(#ArcCenterX#+#ArcRadiusX3#*Cos(Rad(#ArcAngleEnd18#))),(#ArcCenterY#+(1-2*#ArcSweepDirection#)*#ArcRadiusY3#*Sin(Rad(#ArcAngleEnd18#))),#ArcRadiusX3#,#ArcRadiusY3#,360,#ArcSweepDirection#,0,0 | StrokeWidth #ArcStrokeW3# | Stroke Color #ArcStrokeColor2#
Shape20=Arc (#ArcCenterX#+#ArcRadiusX3#*Cos(Rad(#ArcAngleStart19#))),(#ArcCenterY#+(1-2*#ArcSweepDirection#)*#ArcRadiusY3#*Sin(Rad(#ArcAngleStart19#))),(#ArcCenterX#+#ArcRadiusX3#*Cos(Rad(#ArcAngleEnd19#))),(#ArcCenterY#+(1-2*#ArcSweepDirection#)*#ArcRadiusY3#*Sin(Rad(#ArcAngleEnd19#))),#ArcRadiusX3#,#ArcRadiusY3#,360,#ArcSweepDirection#,0,0 | StrokeWidth #ArcStrokeW3# | Stroke Color #ArcStrokeColor2#
Shape21=Arc (#ArcCenterX#+#ArcRadiusX3#*Cos(Rad(#ArcAngleStart20#))),(#ArcCenterY#+(1-2*#ArcSweepDirection#)*#ArcRadiusY3#*Sin(Rad(#ArcAngleStart20#))),(#ArcCenterX#+#ArcRadiusX3#*Cos(Rad(#ArcAngleEnd20#))),(#ArcCenterY#+(1-2*#ArcSweepDirection#)*#ArcRadiusY3#*Sin(Rad(#ArcAngleEnd20#))),#ArcRadiusX3#,#ArcRadiusY3#,360,#ArcSweepDirection#,0,0 | StrokeWidth #ArcStrokeW3# | Stroke Color #ArcStrokeColor2#
Shape22=Arc (#ArcCenterX#+#ArcRadiusX3#*Cos(Rad(#ArcAngleStart21#))),(#ArcCenterY#+(1-2*#ArcSweepDirection#)*#ArcRadiusY3#*Sin(Rad(#ArcAngleStart21#))),(#ArcCenterX#+#ArcRadiusX3#*Cos(Rad(#ArcAngleEnd21#))),(#ArcCenterY#+(1-2*#ArcSweepDirection#)*#ArcRadiusY3#*Sin(Rad(#ArcAngleEnd21#))),#ArcRadiusX3#,#ArcRadiusY3#,360,#ArcSweepDirection#,0,0 | StrokeWidth #ArcStrokeW3# | Stroke Color #ArcStrokeColor3#
DynamicVariables=1
AntiAlias=1

[MeterShape2]
Meter=Shape
Shape=Line 224,300,120,300 | Fill Color 255,255,255,255
AntiAlias=1
EDIT : I'm trying to have arc shape 2 to 11 to rotate based on ellipse center, clockwise.
And arc shapes 12 to 22 to rotate counter-clockwise.

Then i'll have a button, that will have the arcs switch from clockwise to counter-clockwise rotation and vice-versa.
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Help: Switching wallpapers with a button

Post by balala »

Mino_el_Nukenin wrote: May 13th, 2020, 8:06 pm Here is the whole code:
I suspect something is not quite alright with the posted code, because on refresh I get this:
Shape1.png
But after a while:
Shape2.png
Doesn't look well.
You do not have the required permissions to view the files attached to this post.
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 »

balala wrote: May 13th, 2020, 8:39 pm I suspect something is not quite alright with the posted code, because on refresh I get this:
Shape1.png
But after a while:
Shape2.png
Doesn't look well.
Yeah the problem is with the measure and the variables for the rotation (AnchorX and Y)
The rest is okay.
User avatar
Yincognito
Rainmeter Sage
Posts: 7029
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 13th, 2020, 8:42 pm Yeah the problem is with the measure and the variables for the rotation (AnchorX and Y)
The rest is okay.
Yep, there is something strange going on indeed.
First, I'm not going to fix your entire code, but I'll show you how to do it yourself.

With my code inspired meters, you have 2 choices:

Choice 1: Set the rotation center as Rotate [MeasureRotateClockwise],(#ArcCenterX#-#EllipseStrokeW#/2-1),(#ArcCenterY#-#EllipseStrokeW#/2-1). I have no idea why there is the need to subtract those values from #ArcCenterX/Y#, much less 1 (though the latter might be due to rounding?).

Code:

Code: Select all

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

EllipseStrokeW=10
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=25
DynamicWindowSize=1
AccurateText=1

---Measures---

[MeasureRotateClockwise]
Measure=Calc
Formula=(MeasureRotateClockwise+1)%360

---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# | Rotate [MeasureRotateClockwise],(#ArcCenterX#-#EllipseStrokeW#/2-1),(#ArcCenterY#-#EllipseStrokeW#/2-1)
AntiAlias=1
DynamicVariables=1
Choice 2: This one doesn't need those strange subtractions (or the Rotate parameter in the shape) and instead acts directly on the angles in the formulas themselves. I would choose this method over the former, simply because it feels logical and I can't understand the reason for the subtractions above. Of course, you can freely modify the ArcAngleStart=60 and ArcAngleEnd=240 from the [Variables] section, and also the +180 from the measure, to whatever you need. The increment is -1 for clockwise and +1 for counterclockwise, obviously.

Code:

Code: Select all

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

EllipseStrokeW=10
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=25
DynamicWindowSize=1
AccurateText=1

---Measures---

[MeasureRotateClockwise]
Measure=Calc
Formula=(MeasureRotateClockwise-1)%360
OnUpdateAction=[!SetVariable ArcAngleStart [MeasureRotateClockwise]][!SetVariable ArcAngleEnd (([MeasureRotateClockwise]+180)%360)]

---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
DynamicVariables=1
If balala can come up with a reason why those subtractions are needed in the Choice 1, I would be curious to know them. My impression is that they shouldn't be needed.

P.S. Just had a thought...could it be that those subtractions are needed because the Rotate parameter in the Shape is actually based on some kind of adapted TransformationMatrix on the shape? I had this impression from the start, as those "transform modifiers" parameters are even named similar to TransformationMatrix parameters... That being said, if that's so, then there's a serious hole in the manual not specifying that the coordinates should be based similarly to how the TransformationMatrix coordinates are established.

NOTE: The above codes are exactly the same as my initial code creating those arcs, so you won't need to modify anything in your already existing code (assuming it's done correctly, of course) except adding the measure, the dynamic variables option and, if you somehow choose the 1st option, the Rotate parameter.
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 13th, 2020, 9:11 pm Yep, there is something strange going on indeed.
First, I'm not going to fix your entire code, but I'll show you how to do it yourself.

With my code inspired meters, you have 2 choices:

Choice 1: Set the rotation center as Rotate [MeasureRotateClockwise],(#ArcCenterX#-#EllipseStrokeW#/2-1),(#ArcCenterY#-#EllipseStrokeW#/2-1). I have no idea why there is the need to subtract those values from #ArcCenterX/Y#, much less 1 (though the latter might be due to rounding?).

Choice 2: This one doesn't need those strange subtractions (or the Rotate parameter in the shape) and instead acts directly on the angles in the formulas themselves. I would choose this method over the former, simply because it feels logical and I can't understand the reason for the subtractions above. Of course, you can freely modify the ArcAngleStart=60 and ArcAngleEnd=240 from the [Variables] section, and also the +180 from the measure, to whatever you need.


NOTE: The above codes are exactly the same as my initial code creating those arcs, so you won't need to modify anything in your already existing code (assuming it's done correctly, of course) except adding the measure, the dynamic variables option and, if you somehow choose the 1st option, the Rotate parameter.
Actually I don't think I can go with choice 2, since I have a different ArcAngleStart and ArcAngleEnd for each arcs.
It would mean creating a measure for each arcs then.

I'll go with the first, seems easier with my codes config I think.

EDIT Choice 1 not working. The arcs go everywhere...
User avatar
Yincognito
Rainmeter Sage
Posts: 7029
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 13th, 2020, 9:21 pm Actually I don't think I can go with choice 2, since I have a different ArcAngleStart and ArcAngleEnd for each arcs.
It would mean creating a measure for each arcs then.
FALSE! You'd have a single measure, just add [MeasureRotateClockwise] to each of the start/end angles like this:

Code: Select all

[!SetVariable ArcAngleStart1 (([MeasureRotateClockwise]+#ArcAngleStart1#)%360)][!SetVariable ArcAngleEnd1 (([MeasureRotateClockwise]+#ArcAngleEnd1#)%360)][!SetVariable ArcAngleStart2 (([MeasureRotateClockwise]+#ArcAngleStart2#)%360)][!SetVariable ArcAngleEnd2 (([MeasureRotateClockwise]+#ArcAngleEnd2#)%360)]...
in the OnUpdateAction of the measure. An update of the meters followed by a redraw might be needed, but not necessarily, I think.

Common, Mino, start to think for yourself, come up with solutions, be creative. Don't just look at the choices and take them literally. Anything can be tweaked to suit your needs... ;-)
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 13th, 2020, 9:35 pm FALSE! You'd have a single measure, just add [MeasureRotateClockwise] to each of the start/end angles like this:

Code: Select all

[!SetVariable ArcAngleStart1 (([MeasureRotateClockwise]+#ArcAngleStart1#)%360)][!SetVariable ArcAngleEnd1 (([MeasureRotateClockwise]+#ArcAngleEnd1#)%360)][!SetVariable ArcAngleStart2 (([MeasureRotateClockwise]+#ArcAngleStart2#)%360)][!SetVariable ArcAngleEnd2 (([MeasureRotateClockwise]+#ArcAngleEnd2#)%360)]...
in the OnUpdateAction of the measure. An update of the meters followed by a redraw might be needed, but not necessarily, I think.

Common, Mino, start to think for yourself, come up with solutions, be creative. Don't just look at the choices and take them literally. Anything can be tweaked to suit your needs... ;-)
YEah just realized it after trying this solution.
I was tweaking already. I actually just have to put +(difference between arcstart and arcend. Thta's the same thing.

EDIT : Working now, had to put manually each arcstart and arcend to keep the original pattern with the chosen angles.
User avatar
Yincognito
Rainmeter Sage
Posts: 7029
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 13th, 2020, 9:43 pmI was tweaking already. I actually just have to put +(difference between arcstart and arcend. Thta's the same thing.
Exactly.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth