It is currently March 29th, 2024, 9:58 am

Alternating Rotator

Get help with creating, editing & fixing problems with skins
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5384
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Alternating Rotator

Post by eclectic-tech »

At the bottom of the rabbit hole, you'll find this: :welcome:
altrotate.gif
https://www.deviantart.com/eclectic-tech/art/Sound-Square-706885191
You do not have the required permissions to view the files attached to this post.
User avatar
pul53dr1v3r
Posts: 442
Joined: July 30th, 2014, 10:30 am

Re: Alternating Rotator

Post by pul53dr1v3r »

O.O probably i don't need it for now. But i need a little help with my rotator meter.
So, i'm trying to set the arrow to be in the next positions when:
Formula=0 - right (=3h)
Formula=1 - up (= 12h)
Formula=2 - down (= 6h)

This is a piece of cake in comparison with those examples.

I attached the arrow image below so just put it in the @Resource folder to use the skin for the test.

Code: Select all

[Rainmeter]
Update=1000
AccurateText=1
MiddleMouseDownAction=[!Refresh]

[Variables]

[meterBg]
Meter=Shape
Shape=Rectangle 0,0,50,50,5 | Fill Color 0,0,0

[Measure1]
Measure=Calc
Formula=0
MinValue=0
MaxValue=2

[Meter1]
Meter=Rotator
MeasureName=Measure1
ImageName="#@#Arrow.png"
ImageTint=255,255,255
ImageAlpha=255
StartAngle=4.7
RotationAngle=127.4
ValueRemainder=3
OffsetX=6
OffsetY=6
W=12
H=12
X=(25-[#CURRENTSECTION#:W]/2)
Y=(25-[#CURRENTSECTION#:W]/2)
DynamicVariables=1
You do not have the required permissions to view the files attached to this post.
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Alternating Rotator

Post by balala »

Pul53dr1v3r wrote: November 22nd, 2019, 7:47 pm So, i'm trying to set the arrow to be in the next positions when:
Formula=0 - right (=3h)
Formula=1 - up (= 12h)
Formula=2 - down (= 6h)
Instead of using a Rotator meter, I'd use an Image and I'd rotate this meter through a TransformationMatrix. For instance replace the [Meter1] meter with the following one:

Code: Select all

[Meter1]
Meter=Image
ImageName=#@#Arrow.png
X=(25-[#CURRENTSECTION#:W]/2)
Y=(25-[#CURRENTSECTION#:W]/2)
W=12
H=12
TransformationMatrix=(Cos((([Measure1]+([Measure1]=2))+1)*PI/2));(-Sin((([Measure1]+([Measure1]=2))+1)*PI/2));(Sin((([Measure1]+([Measure1]=2))+1)*PI/2));(Cos((([Measure1]+([Measure1]=2))+1)*PI/2));([#CURRENTSECTION#:X]+[#CURRENTSECTION#:W]/2)-([#CURRENTSECTION#:X]+[#CURRENTSECTION#:W]/2)*Cos((([Measure1]+([Measure1]=2))+1)*PI/2)-([#CURRENTSECTION#:Y]+[#CURRENTSECTION#:H]/2)*Sin((([Measure1]+([Measure1]=2))+1)*PI/2);([#CURRENTSECTION#:Y]+[#CURRENTSECTION#:H]/2)+([#CURRENTSECTION#:X]+[#CURRENTSECTION#:W]/2)*Sin((([Measure1]+([Measure1]=2))+1)*PI/2)-([#CURRENTSECTION#:Y]+[#CURRENTSECTION#:H]/2)*Cos((([Measure1]+([Measure1]=2))+1)*PI/2)
DynamicVariables=1
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5384
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Alternating Rotator

Post by eclectic-tech »

balala already offered a solution, but here is one using a Rotate Meter

Code: Select all

; You requested:
; Formula=0 - right (=3h)
; Formula=1 - up (= 12h)
; Formula=2 - down (= 6h)

[Rainmeter]
Update=1000
AccurateText=1
MiddleMouseDownAction=[!Refresh]

[Variables]

[meterBg]
Meter=Shape
Shape=Rectangle 0,0,50,50,5 | Fill Color 0,0,0

[Measure1]
Measure=Calc
Formula=Random
LowBound=0
HighBound=2
UniqueRandom=1
UpdateRandom=1

; The Rotate measure is looking for percentage values and 90 degree changes of 360 degrees are what is desired
[Measure2]
Measure=Calc
Formula=(Measure1*90)+(Measure1=2? 90:0)
MinValue=0
MaxValue=360

; Because the "arrow" image is drawn pointing downward, we need to start at minus 90 degrees, so that zero percent is at 3 o'clock
; Measure2 returns values of 0%, 25%(90/360), and 75%(270/360) 
[Meter1]
Meter=Rotator
MeasureName=Measure2
ImageName="#@#Arrow.png"
ImageTint=255,255,255
ImageAlpha=255
StartAngle=(-Rad(90))
RotationAngle=(-Rad(360))
;ValueRemainder=3
OffsetX=6
OffsetY=6
W=12
H=12
X=(25-[#CURRENTSECTION#:W]/2)
Y=(25-[#CURRENTSECTION#:W]/2)
DynamicVariables=1
Click image to animate...
arrow.gif
You do not have the required permissions to view the files attached to this post.
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Alternating Rotator

Post by balala »

eclectic-tech wrote: November 22nd, 2019, 9:39 pm balala already offered a solution, but here is one using a Rotate Meter
Sorry eclectic-tech, when you posted your solution, I already started writing mine, so I post that one as well. It's almost the same one. Hope you don't mind.
balala wrote: November 22nd, 2019, 9:19 pm Instead of using a Rotator meter, I'd use an Image and I'd rotate this meter through a TransformationMatrix. For instance replace the [Meter1] meter with the following one:
Alternatively it can be done even with a Rotator meter, but inn this case you have to add a suplimentar measure. Add it:

Code: Select all

[Measure2]
Measure=Calc
Formula=( Measure1 + ( Measure1 = 2 ))
MinValue=0
MaxValue=4
Note that because this measure will be used into the MeasureName option of the Rotator meter, you can remove the MinValue and MaxValue options of the [Measure1] measure. You don't need them anymore.
Now the Rotator meter should look like the following one:

Code: Select all

[Meter1]
Meter=Rotator
MeasureName=Measure2
ImageName="#@#Arrow.png"
ImageTint=255,255,255
ImageAlpha=255
StartAngle=(-PI/2)
RotationAngle=(-2*PI)
;ValueRemainder=3
OffsetX=6
OffsetY=6
W=12
H=12
X=(25-[#CURRENTSECTION#:W]/2)
Y=(25-[#CURRENTSECTION#:W]/2)
DynamicVariables=1
Note the removed (commented out) ValueReminder option.
User avatar
pul53dr1v3r
Posts: 442
Joined: July 30th, 2014, 10:30 am

Re: Alternating Rotator

Post by pul53dr1v3r »

Thank you both geniuses! All te solution are giving the desired result, but the two basen on Rotate meters are the best in my opinion.
The first solution has too long formula that is not easy to understand and edit, but those based on the Rotators are excellent. I'll use one of them.
:Ok :Trophy :Trophy :cheers:
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5384
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Alternating Rotator

Post by eclectic-tech »

Happy to help!

You'll notice I am more comfortable using Radian defined by 360 degree rotation, while balala, who loves formulas ;-), uses those to represent the same values.

We also used similar approaches to defining the desired rotation in [Measure2]. I used angles based on 360 degrees while balala simplified it to 0 to 4 positions; both will achieve the same result, taking different tactics.

If we all did things the same, it would be a very boring world! :yawn: :lol:
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Alternating Rotator

Post by balala »

Pul53dr1v3r wrote: November 22nd, 2019, 11:00 pm The first solution has too long formula that is not easy to understand and edit,
I agree it can be frightening, but if you invest a little bit time and energy, in fact it's not too complicated, even if it does look so. It is just simple math, applied as it is described into the Transformation Matrix Guide.
But yes, I have to admit math was always a good friend of mine.
User avatar
pul53dr1v3r
Posts: 442
Joined: July 30th, 2014, 10:30 am

Re: Alternating Rotator

Post by pul53dr1v3r »

balala wrote: November 23rd, 2019, 3:06 pm I agree it can be frightening, but if you invest a little bit time and energy, in fact it's not too complicated, even if it does look so. It is just simple math, applied as it is described into the Transformation Matrix Guide.
But yes, I have to admit math was always a good friend of mine.
Yes, but TransfomationMatrix option for the meter has been used for the scale. So it's out of the question anyway.
eclectic-tech wrote: November 23rd, 2019, 1:07 am If we all did things the same, it would be a very boring world! :yawn: :lol:
agree. This way anyone of us can learn sth new, even you and balala from each other etc. :rosegift:
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Alternating Rotator

Post by balala »

Pul53dr1v3r wrote: November 25th, 2019, 4:25 pm Yes, but TransfomationMatrix option for the meter has been used for the scale. So it's out of the question anyway.
TransformationMatrix can be used even in a such case. You just have to multiply the two matrices together. Interested?