It is currently March 28th, 2024, 3:55 pm

Using ActionTimer to move entire skin

Get help with creating, editing & fixing problems with skins
Post Reply
User avatar
Virginityrocks
Posts: 478
Joined: February 26th, 2011, 10:22 pm

Using ActionTimer to move entire skin

Post by Virginityrocks »

I can't seem to find a way for ActionTimer to move an entire skin's X or Y position, only individual meters within the skin. Is this possible?
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Using ActionTimer to move entire skin

Post by jsmorley »

Code: Select all

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

[Variables]
U=[!UpdateMeasure Slider]
SkinX=600

[MeterDaBox]
Meter=Image
W=300
H=100
SolidColor=164,0,56,255
MouseOverAction=[!CommandMeasure Slider "Stop 2"][!CommandMeasure Slider "Execute 1"]
MouseLeaveAction=[!CommandMeasure Slider "Stop 1"][!CommandMeasure Slider "Execute 2"]

[Slider]
Measure=Plugin
Plugin=ActionTimer
ActionList1=Repeat SlideLeft, 1, 50
SlideLeft=[!SetVariable SkinX "(Clamp(#SkinX#-2,300,900))"][!Move "#SkinX#" "100"]#U#
ActionList2=Repeat SlideRight, 1, 50
SlideRight=[!SetVariable SkinX "(Clamp(#SkinX#+2,300,900))"][!Move "#SkinX#" "100"]#U#
DynamicVariables=1
Click to animate
gif.gif
The long and the short of it is that the entire skin can only be moved with the !Move bang, https://docs.rainmeter.net/manual/bangs/#Move, which is an "action", not a "setting", and which requires an absolute position on the screen, not a position relative to the skin as a meter's X and Y are. While the bang is called !Move, in a sense it is really "place". Both X and Y are required parameters to the bang.

With a little bit of work and some math, you could probably make it more like "move" than "place", by using the starting value (NOT the current value as you go) of #CURRENTCONFIGX#, which is the current position of the skin on the screen. Then add and subtract from that and apply it to the !Move bang to move the skin relative to where it "started" and not an absolute position. Tricky to manage if you drag the skin somewhere else while the skin is loaded.

To be honest, sorta goes against the grain for Rainmeter, as we see the position of skins on the screen something generally that the end-user should control by dragging, and the author controls where meters are within the skin. Unless "where the skin is on the screen" is integral to the functionality, I'd tend to be hesitant to use it. I would lean toward a skin that is big enough, even if full screen, to contain things, and set the background to be entirely invisible and undetectable with SolidColor=0,0,0,0. Then I would move the meters inside of that. But, to each his own...
PHILleHUt
Posts: 17
Joined: April 8th, 2020, 2:35 pm
Location: PARIS - FRANCE

Re: Using ActionTimer to move entire skin

Post by PHILleHUt »

HI all,

Well, if I anderstand, if U click, the shape moves... :welcome:

Is it possible (of course yes) to move the shape when you open the skin?

I tried and try to find a solution without sucess :oops:
User avatar
Yincognito
Rainmeter Sage
Posts: 7024
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Using ActionTimer to move entire skin

Post by Yincognito »

PHILleHUt wrote: April 25th, 2020, 4:46 pm HI all,

Well, if I anderstand, if U click, the shape moves... :welcome:

Is it possible (of course yes) to move the shape when you open the skin?

I tried and try to find a solution without sucess :oops:
No, you don't understand:
- it's not the shape that moves (by the way, there is no shape in this skin, only a colored image), but the skin
- the movement is not triggered by a mouse click, but by mouse over / leave (i.e. hovering or not) on the skin
- it's not possible to move the skin when you "open" it, but it is however possible to move the skin when you load (or activate) it
- apparently, you didn't try hard enough, since simply moving the content of the MouseOverAction + MouseLeaveAction lines above (while separating them with a !Delay bang) to an OnRefreshAction option in the [Rainmeter] section of the skin does the trick:

Code: Select all

OnRefreshAction=[!CommandMeasure Slider "Stop 2"][!CommandMeasure Slider "Execute 1"][!Delay 3000][!CommandMeasure Slider "Stop 1"][!CommandMeasure Slider "Execute 2"]
Yes, it was that simple. Feel free to adapt this to your needs.
Post Reply