It is currently December 9th, 2023, 3:30 pm

I need help with shifting

Get help with creating, editing & fixing problems with skins
Oziv44
Posts: 5
Joined: November 5th, 2023, 4:25 pm

I need help with shifting

Post by Oziv44 »

Hello, I need help with the widget again. I created such a widget and I don't know why the red square disappears.
animation.gif

Here is the script:

Code: Select all

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

[Variables]
OffSet=400
Y2=200
State=1
U=[!UpdateMeasure MeasureSlider][!UpdateMeter *][!Redraw]
G=[!UpdateMeter *][!Redraw]

; Slider Measure

[MeasureSlider]
Measure=Plugin
Plugin=ActionTimer
ActionList1=Repeat SlideLeft, 3, 110
SlideLeft=[!SetVariable State "2"][!SetVariable OffSet "(Clamp(#OffSet#-4.5,-20,400))"]#U#
ActionList2=Repeat SlideRight, 3, 110
SlideRight=[!SetVariable State "1"][!SetVariable OffSet "(Clamp(#OffSet#+4.5,-20,400))"]#U#
DynamicVariables=1

; Meters

[MeterSlider]
Meter=Image
X=380
W=20
H=350
SolidColor=0,0,0,255
DynamicVariables=1
LeftMouseUpAction=[!CommandMeasure MeasureSlider "Execute #State#"]

[MeterBack]
Meter=Image
X=#OffSet#
W=400
H=700
SolidColor=255,50,255,255
DynamicVariables=1

[MeterRedSquare]
Meter=Image
ImageName=square.png
X=(#OffSet# - 50)
Y=#Y2#
W=50
H=50
DynamicVariables=1
LeftMouseUpAction=["App.exe"]
You do not have the required permissions to view the files attached to this post.
User avatar
balala
Rainmeter Sage
Posts: 15840
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: I need help with shifting

Post by balala »

Moved the whole topic from the Other Software & Customization section to Help: Rainmeter Skins.
Oziv44 wrote: November 11th, 2023, 6:33 pm I don't know why the red square disappears.
Because when the ActionList1 of the [MeasureSlider] measure is executed, the value of the Offset variable decreases to -20. The X option of the [MeterRedSquare] meter is set to X=(#OffSet# - 50), which means at the end, the meter is positioned to X=-70. Its width being set to W=50, when it gets its leftmost position, it goes outside of the skin to left. No meters this way positioned can be seen.
A solution is to limit the value of the X option of the meter, to not let it to decrease too much, until the meter is not seeable anymore. For instance you can add a Clamp function to the X option of the [MeterRedSquare] meter, like the following one: X=(Clamp((#OffSet#-50),0,400)). See that if you add this function, the meter will be kept always on the visible surface of the skin. But obviously what the proper solution is, depends on where would you like to get the meter when the ActionTimer plugin measure decreases the Offset variable.