It is currently August 8th, 2020, 11:30 pm

## Help: Switching wallpapers with a button

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

### Re: Help: Switching wallpapers with a button

I'm trying to have different arc shapes rotating, based on the center of a circle.
I came up with this measure

Code: Select all

``````[MeasureRotateClockwise]
Measure=Calc
Formula=(MeasureRotateClockwise+1)%360``````
And then added Rotate [MeasureRotateClockwise],#EllipseCenterX#,#EllipseCenterY# at the end of the shape line code.
But no result.
Not sure what I missed.
Mino_el_Nukenin
Posts: 224
Joined: April 24th, 2020, 7:39 pm
Location: France

### Re: Help: Switching wallpapers with a button

Yincognito wrote:
May 13th, 2020, 1:44 am
Any help with this rotating problem I have ?

I've modified the measure as one I saw on the forum:

Code: Select all

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

Code: Select all

``````AnchorX=(#EllipseCenterX#-#ArcCenterX#+#ArcRadiusX#)
And this to the arcs I want to rotate, but nothing :
Rotate [MeasureRotate],#AnchorX#,#AnchorY#
balala
Rainmeter Sage
Posts: 11181
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

### Re: Help: Switching wallpapers with a button

Mino_el_Nukenin wrote:
May 13th, 2020, 7:51 pm
And this to the arcs I want to rotate, but nothing :
Rotate [MeasureRotate],#AnchorX#,#AnchorY#
Have you added a DynamicVariables=1 option to that meter?
Mino_el_Nukenin
Posts: 224
Joined: April 24th, 2020, 7:39 pm
Location: France

### Re: Help: Switching wallpapers with a button

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 ...
Yincognito
Posts: 2200
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

### Re: Help: Switching wallpapers with a button

balala wrote:
May 13th, 2020, 8:00 pm
Have you added a DynamicVariables=1 option to that meter?
Mino_el_Nukenin
Posts: 224
Joined: April 24th, 2020, 7:39 pm
Location: France

### Re: Help: Switching wallpapers with a button

Yincognito wrote:
May 13th, 2020, 8:03 pm
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
ArcStrokeW1=8
ArcStrokeW2=4
ArcStrokeW3=6
ArcCenterX=(#EllipseCenterX#)
ArcCenterY=(#EllipseCenterY#)
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 ---

===== 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#

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.
balala
Rainmeter Sage
Posts: 11181
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

### Re: Help: Switching wallpapers with a button

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: 224
Joined: April 24th, 2020, 7:39 pm
Location: France

### Re: Help: Switching wallpapers with a button

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.
Yincognito
Posts: 2200
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

### Re: Help: Switching wallpapers with a button

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
ArcStrokeW=15
ArcCenterX=(#EllipseCenterX#)
ArcCenterY=(#EllipseCenterY#)
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#
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
ArcStrokeW=15
ArcCenterX=(#EllipseCenterX#)
ArcCenterY=(#EllipseCenterY#)
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#
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.
Mino_el_Nukenin
Posts: 224
Joined: April 24th, 2020, 7:39 pm
Location: France

### Re: Help: Switching wallpapers with a button

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...