It is currently April 26th, 2024, 4:58 am

Adjust Height of image on mouseover

Get help with creating, editing & fixing problems with skins
webbkaler
Posts: 2
Joined: October 30th, 2022, 5:31 pm

Adjust Height of image on mouseover

Post by webbkaler »

Is there a way I can use MouseOverAction to adjust the height of an image?
User avatar
tass_co
Posts: 518
Joined: May 4th, 2020, 3:01 pm
Location: Ankara, TURKEY

Re: Adjust Height of image on mouseover

Post by tass_co »

webbkaler wrote: October 30th, 2022, 5:34 pm Is there a way I can use MouseOverAction to adjust the height of an image?

Code: Select all

[Rainmeter]
Update=1000


[Meter1]
Meter=Image
X=0
Y=0
W=100
H=100
SolidColor=255,0,0
DynamicVariables=1
MouseOverAction=[!SetOption Meter1 H "200"][!UpdateMeter Meter1]
MouseLeaveAction=[!SetOption Meter1 H "100"][!UpdateMeter Meter1]
I don't know where i going from here, but i promise it won't be boring... :great:
User avatar
balala
Rainmeter Sage
Posts: 16172
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Adjust Height of image on mouseover

Post by balala »

webbkaler wrote: October 30th, 2022, 5:34 pm Is there a way I can use MouseOverAction to adjust the height of an image?
In addition to tass_co's reply, note that his code is perfectly working, with one small remark: with it, you don't adjust the height of an image, but the height of an Image meter (sorry, don't want to nitpick, just felt have to precise this).
tass_co wrote: October 30th, 2022, 5:46 pm

Code: Select all

[Rainmeter]
Update=1000


[Meter1]
Meter=Image
X=0
Y=0
W=100
H=100
SolidColor=255,0,0
DynamicVariables=1
MouseOverAction=[!SetOption Meter1 H "200"][!UpdateMeter Meter1]
MouseLeaveAction=[!SetOption Meter1 H "100"][!UpdateMeter Meter1]
Same thing as previously said: don't want to nitpick, but updating the [Meter1] meter and not redrawing the skin is usless, and just consumes resources. So when you want to get visually updated a meter, always add the [!Redraw] bang as well, besides the [!UpdateMeter ...]:

Code: Select all

[Meter1]
...
MouseOverAction=[!SetOption Meter1 H "200"][!UpdateMeter "Meter1"][!Redraw]
MouseLeaveAction=[!SetOption Meter1 H "100"][!UpdateMeter "Meter1"][!Redraw]
The [!UpdateMeter ...] bang updates the meter, but the result is not seen until next update cycle of the skin, unless you're redrawing the skin, which is done by the [!Redraw] bang.
Hope you don't mind I'm commenting. Again...
User avatar
tass_co
Posts: 518
Joined: May 4th, 2020, 3:01 pm
Location: Ankara, TURKEY

Re: Adjust Height of image on mouseover

Post by tass_co »

balala wrote: October 30th, 2022, 8:28 pm Hope you don't mind I'm commenting. Again...
:bow:
I don't know where i going from here, but i promise it won't be boring... :great:
webbkaler
Posts: 2
Joined: October 30th, 2022, 5:31 pm

Re: Adjust Height of image on mouseover

Post by webbkaler »

Thanks so much guys. I finally got it working. Here's my code for it:
Please feel free to use this. Basically I have a .png that I use as a game icon. This makes it so when I hover over it, it will get a little bigger and also reposition so that it's centered.

Code: Select all

[INFRASPACE]
Meter=Image
ImageName=#@#Images\infraspace.png
H=90
MouseOverAction=[Play "#@#Sounds\click3.wav"][!SetOption #CURRENTSECTION# X "-5"][!SetOption #CURRENTSECTION# Y "-5"][!SetOption #CURRENTSECTION# H "100"][!UpdateMeter "#CURRENTSECTION#"][!Redraw]
MouseLeaveAction=[!SetOption #CURRENTSECTION# X "0"][!SetOption #CURRENTSECTION# Y "0"][!SetOption #CURRENTSECTION# H "90"][!UpdateMeter "#CURRENTSECTION#"][!Redraw]
LeftMouseUpAction=["C:\Users\Kaler\Documents\game_exes\InfraSpace.url"][Play "#@#Sounds\click2.wav"]
User avatar
balala
Rainmeter Sage
Posts: 16172
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Adjust Height of image on mouseover

Post by balala »

webbkaler wrote: October 31st, 2022, 4:14 am Here's my code for it:
This code works well, ONLY if the used image (@Resources\Images\infraspace.png) has a transparent left and upper margin. If these transparent margins are not there, when you're hovering the mouse over the image, the above two sides of the image go outside of the skin and won't be visible. Note that there is not visible any part of any meter which has negative coordinates, which is the case this time when hovering the mouse over the skin. This is why I'd modify the code a little bit this way:

Code: Select all

[INFRASPACE]
Meter=Image
ImageName=#@#Images\infraspace.png
X=5
Y=5
H=90
MouseOverAction=[Play "#@#Sounds\click3.wav"][!SetOption #CURRENTSECTION# X "0"][!SetOption #CURRENTSECTION# Y "0"][!SetOption #CURRENTSECTION# H "100"][!UpdateMeter "#CURRENTSECTION#"][!Redraw]
MouseLeaveAction=[!SetOption #CURRENTSECTION# X "5"][!SetOption #CURRENTSECTION# Y "5"][!SetOption #CURRENTSECTION# H "90"][!UpdateMeter "#CURRENTSECTION#"][!Redraw]
LeftMouseUpAction=["C:\Users\Kaler\Documents\game_exes\InfraSpace.url"][Play "#@#Sounds\click2.wav"]
[/quote]
See the added X and Y options and the modified values in the first two !SetOption bangs of both options, MouseHoverAction and MouseLeaveAction.