It is currently April 28th, 2024, 4:21 am

I need help with shifting

Get help with creating, editing & fixing problems with skins
Oziv44
Posts: 6
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: 16182
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.
Oziv44
Posts: 6
Joined: November 5th, 2023, 4:25 pm

Re: I need help with shifting

Post by Oziv44 »

When I use this script, the red square moves to the right. I need the red square to behave as it did at the beginning of the animation.
User avatar
balala
Rainmeter Sage
Posts: 16182
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: I need help with shifting

Post by balala »

Oziv44 wrote: December 22nd, 2023, 4:45 pm I need the red square to behave as it did at the beginning of the animation.
Sorry, no, it doesn't. It moves to left. With your code it moves to left and goes outside of the visible area of the skin, to left. Replacing the X option of the [MeterRedSquare] with the one I proposed above, the square moves same way to left, but when it reaches the most-left part of the skin, it remains visible.
Oziv44 wrote: December 22nd, 2023, 4:45 pm I need the red square to behave as it did at the beginning of the animation.
As far as I can tell, with the proposed modification of the X option, it behaves exactly as on the beginning of the animation, with the requested addition: it is kept on the skin, not going outside of it.
So, I can't really follow what would you like to achieve. Please give us a few details.