It is currently June 16th, 2021, 10:41 am

Rotator meter help

Help with creating, editing & fixing problems with skins
ItsJustRyan
Posts: 48
Joined: October 25th, 2019, 1:20 am

Rotator meter help

Post by ItsJustRyan »

Hi!

At the moment I'm trying to make something like a spotlight that swings from side to side. I've managed to get it to swing in one direction but I am not sure how to get it to not look so jittery or make it change directions. Thanks!

Code: Select all

[Rainmeter]
Update=10
DynamicWindowSize=1

[Variables]
ImageW=235
ImageH=1390

[MeasureRotate]
Measure=Calc
Formula=(MeasureRotate % 50) + 1
MaxValue=360

[MeterRotate]
Meter=Rotator
MeasureName=MeasureRotate
ImageName=#@#Images/TriangleSL2.png
X=(#ImageW# / 2)+45
Y=20
OffsetX=(#ImageW# / 2)
OffsetY=(#ImageH#)
W=(SQRT(#ImageW# ** 2 + #ImageH# ** 2))
H=(SQRT(#ImageW# ** 2 + #ImageH# ** 2))
StartAngle=-0.8

[MeterBG]
Meter=Shape
Shape=Rectangle 0,0,2050,900 | StrokeWidth 0 | Fill Color 255,255,255,1
User avatar
balala
Rainmeter Sage
Posts: 12782
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Rotator meter help

Post by balala »

ItsJustRyan wrote: June 2nd, 2021, 6:21 pm I've managed to get it to swing in one direction but I am not sure how to get it to not look so jittery or make it change directions.
Replace the Formula option of the [MeasureRotate] measure with the following one: Formula=(( MeasureRotate > 0 ) ? ( MeasureRotate - 1 ) : 49 ).
ItsJustRyan
Posts: 48
Joined: October 25th, 2019, 1:20 am

Re: Rotator meter help

Post by ItsJustRyan »

balala wrote: June 2nd, 2021, 7:09 pm Replace the Formula option of the [MeasureRotate] measure with the following one: Formula=(( MeasureRotate > 0 ) ? ( MeasureRotate - 1 ) : 49 ).
Would i use an if statement or something similar to make it alternate between the two? Thanks!
User avatar
CodeCode
Posts: 390
Joined: September 7th, 2020, 2:24 pm

Re: Rotator meter help

Post by CodeCode »

balala wrote: June 2nd, 2021, 7:09 pm Replace the Formula option of the [MeasureRotate] measure with the following one: Formula=(( MeasureRotate > 0 ) ? ( MeasureRotate - 1 ) : 49 ).
If I understand (i mightn't btw), the same formula concept can be used for the reverse direction:

Formula=(( MeasureRotate < 50 ) ? ( MeasureRotate + 1 ) : 1 ) This may be really wrong so wait for balala to confirm or correct :oops:
ƈǟռ'ȶ ʄɨӼ ɨȶ ɨʄ ɨȶ ǟɨռ'ȶ ɮʀօӄɛ - ʊռʟɛֆֆ ɨȶ ɨֆ ɨռ ƈօɖɛ.
User avatar
balala
Rainmeter Sage
Posts: 12782
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Rotator meter help

Post by balala »

CodeCode wrote: June 2nd, 2021, 8:14 pm If I understand (i mightn't btw), the same formula concept can be used for the reverse direction:

Formula=(( MeasureRotate < 50 ) ? ( MeasureRotate + 1 ) : 1 ) This may be really wrong so wait for balala to confirm or correct :oops:
It's correct, but it's not needed. The original formula (Formula=(MeasureRotate % 50) + 1), used by ItsJustRyan is good enough and much simpler. When the value has to decrease this doesn't work, but one possible solution is the formula I proposed.
ItsJustRyan
Posts: 48
Joined: October 25th, 2019, 1:20 am

Re: Rotator meter help

Post by ItsJustRyan »

balala wrote: June 2nd, 2021, 8:31 pm It's correct, but it's not needed. The original formula (Formula=(MeasureRotate % 50) + 1), used by ItsJustRyan is good enough and much simpler. When the value has to decrease this doesn't work, but one possible solution is the formula I proposed.
The thing is it goes anticlockwise and then jumps back rather than constantly switching unlessi mucked something up lol.
User avatar
CodeCode
Posts: 390
Joined: September 7th, 2020, 2:24 pm

Re: Rotator meter help

Post by CodeCode »

I think you need another condition or match test for the min/max of the two formulas and change each way accordingly.
ƈǟռ'ȶ ʄɨӼ ɨȶ ɨʄ ɨȶ ǟɨռ'ȶ ɮʀօӄɛ - ʊռʟɛֆֆ ɨȶ ɨֆ ɨռ ƈօɖɛ.
ItsJustRyan
Posts: 48
Joined: October 25th, 2019, 1:20 am

Re: Rotator meter help

Post by ItsJustRyan »

CodeCode wrote: June 2nd, 2021, 8:42 pm I think you need another condition or match test for the min/max of the two formulas and change each way accordingly.
so a calc measure with an if statemnt checking if it reached/is greater than a certain angle and set a variable to 1 or 0 which governs another if statement deciding which formula to use?
User avatar
CodeCode
Posts: 390
Joined: September 7th, 2020, 2:24 pm

Re: Rotator meter help

Post by CodeCode »

ItsJustRyan wrote: June 2nd, 2021, 8:44 pm so a calc measure with an if statemnt checking if it reached/is greater than a certain angle and set a variable to 1 or 0 which governs another if statement deciding which formula to use?
Yeo, thats the ticket.
ƈǟռ'ȶ ʄɨӼ ɨȶ ɨʄ ɨȶ ǟɨռ'ȶ ɮʀօӄɛ - ʊռʟɛֆֆ ɨȶ ɨֆ ɨռ ƈօɖɛ.
User avatar
eclectic-tech
Rainmeter Sage
Posts: 4300
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Rotator meter help

Post by eclectic-tech »

ItsJustRyan wrote: June 2nd, 2021, 8:44 pm so a calc measure with an if statemnt checking if it reached/is greater than a certain angle and set a variable to 1 or 0 which governs another if statement deciding which formula to use?
The test to reverse direction can be added to the existing rotate measure.

Code: Select all

[Rainmeter]
Update=16
DynamicWindowSize=1

[Variables]
; ImageW=235
; ImageH=1390
ImageW=330
ImageH=220

[MeasureRotate]
Measure=Calc
Formula=(MeasureRotate % 50) + 1
MaxValue=360
IfCondition=(MeasureRotate=49)
IfTrueAction=[!SetOption MeasureRotate Formula "(( MeasureRotate > 0 ) ? ( MeasureRotate - 1 ) : 49 )"]
IfCondition2=(MeasureRotate=0)
IfTrueAction2=[!SetOption MeasureRotate Formula "(MeasureRotate % 50) + 1"] 

[MeterRotate]
Meter=Rotator
MeasureName=MeasureRotate
ImageName=#@#Images/TriangleSL2.png
X=(#ImageW# / 2)+45
Y=20
OffsetX=(#ImageW# / 2)
OffsetY=(#ImageH#)
W=(SQRT(#ImageW# ** 2 + #ImageH# ** 2))
H=(SQRT(#ImageW# ** 2 + #ImageH# ** 2))
StartAngle=-0.8

; [MeterBG]
; Meter=Shape
; Shape=Rectangle 0,0,2050,900 | StrokeWidth 0 | Fill Color 255,255,255,1
Notes: I changed the skin update to the fastest possible rate of 16 milliseconds and used a smaller image (330x220) to test.
I also commented out the full screen shape that prevented desktop interactions.
Test image:
TriangleSL2.png
Aside: I am not sure how happy you will be using large images and fast updates; This is going to eat up a lot of CPU cycles! :???:
arc50.gif
You do not have the required permissions to view the files attached to this post.