It is currently April 26th, 2024, 4:58 am
Adjust Height of image on mouseover
-
- Posts: 2
- Joined: October 30th, 2022, 5:31 pm
Adjust Height of image on mouseover
Is there a way I can use MouseOverAction to adjust the height of an image?
-
- Posts: 518
- Joined: May 4th, 2020, 3:01 pm
- Location: Ankara, TURKEY
Re: Adjust Height of image on mouseover
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...
-
- Rainmeter Sage
- Posts: 16172
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: Adjust Height of image on mouseover
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).
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 ...]:tass_co wrote: ↑October 30th, 2022, 5:46 pmCode: 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]
Code: Select all
[Meter1]
...
MouseOverAction=[!SetOption Meter1 H "200"][!UpdateMeter "Meter1"][!Redraw]
MouseLeaveAction=[!SetOption Meter1 H "100"][!UpdateMeter "Meter1"][!Redraw]
Hope you don't mind I'm commenting. Again...
-
- Posts: 518
- Joined: May 4th, 2020, 3:01 pm
- Location: Ankara, TURKEY
Re: Adjust Height of image on mouseover
I don't know where i going from here, but i promise it won't be boring...
-
- Posts: 2
- Joined: October 30th, 2022, 5:31 pm
Re: Adjust Height of image on mouseover
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.
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"]
-
- Rainmeter Sage
- Posts: 16172
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: Adjust Height of image on mouseover
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"]
See the added X and Y options and the modified values in the first two !SetOption bangs of both options, MouseHoverAction and MouseLeaveAction.