It is currently May 7th, 2024, 10:30 pm

Changing width and height of bar with image

Get help with creating, editing & fixing problems with skins
User avatar
JpsCrazy
Posts: 667
Joined: April 18th, 2010, 2:16 pm
Location: NY, USA

Changing width and height of bar with image

Post by JpsCrazy »

Can't be done?

[Variables]
Width=50

[mtVolume]
Meter=Bar
MeasureName=msGetSoundVolume
BarImage=Volume.png
W=#Width#

With Width=50 and Width=5000 being the same length.

Is there some sort of work around, am I making a mistake, or is this a limitation of Rainmeter?
User avatar
smurfier
Moderator
Posts: 1931
Joined: January 29th, 2010, 1:43 am
Location: Willmar, MN

Re: Changing width and height of bar with image

Post by smurfier »

Are you talking about scaling a bar with an image?

If so, I've tried that and it doesn't work. Your best bet is a bit of a trick with image crop.

Code: Select all

[Crop]
Measure=Calc
Formula=OriginalWidth*(ActualValue/MaxValue)

[Bar]
Meter=Image
ImageName=Blah.jpg
ImageCrop=0,0,[Crop],OriginalHeight
H=NewHeight
W=(NewWidth*(ActualValue/MaxValue))
GitHub | DeviantArt | Tumblr
This is the song that never ends. It just goes on and on my friends. Some people started singing it not knowing what it was, and they'll continue singing it forever just because . . .
User avatar
JpsCrazy
Posts: 667
Joined: April 18th, 2010, 2:16 pm
Location: NY, USA

Re: Changing width and height of bar with image

Post by JpsCrazy »

...yes? I think so at least.


Alright, it worked with a little editing.

[CropCalcVolume]
Measure=Calc
Formula=msGetSoundVolume/100

[CropVolume]
Measure=Calc
Formula=93*CropCalcVolume

[mtVolume]
Meter=Image
ImageName=Volume.png
ImageCrop=0,0,[CropVolume],7
DynamicVariables=1
H=(#Width#/90)
W=((#Width#/7.5)*[CropCalcVolume])

For some reason I needed CropCalcVolume to be seperate instead of using what it is in mtVolume.


Thank you.
This should be in Tips and Tricks. ;)
User avatar
smurfier
Moderator
Posts: 1931
Joined: January 29th, 2010, 1:43 am
Location: Willmar, MN

Re: Changing width and height of bar with image

Post by smurfier »

One is glad to be of assistance.
GitHub | DeviantArt | Tumblr
This is the song that never ends. It just goes on and on my friends. Some people started singing it not knowing what it was, and they'll continue singing it forever just because . . .
User avatar
JpsCrazy
Posts: 667
Joined: April 18th, 2010, 2:16 pm
Location: NY, USA

Re: Changing width and height of bar with image

Post by JpsCrazy »

By any chance would you know of a way to somehow work '!RainmeterRedraw' into this?
The Volume bar for this doesn't update as fast as I'd like it to... And I don't want to have Update set too frequent.

Right now I have it set so when I click the meter that changes the 'actual value' it Redraws, but it redraws before all the Calcs with the 'actual value' are calculated.
User avatar
smurfier
Moderator
Posts: 1931
Joined: January 29th, 2010, 1:43 am
Location: Willmar, MN

Re: Changing width and height of bar with image

Post by smurfier »

I believe that in the newest beta there is a !RainmeterUpdate bang.
GitHub | DeviantArt | Tumblr
This is the song that never ends. It just goes on and on my friends. Some people started singing it not knowing what it was, and they'll continue singing it forever just because . . .
User avatar
JpsCrazy
Posts: 667
Joined: April 18th, 2010, 2:16 pm
Location: NY, USA

Re: Changing width and height of bar with image

Post by JpsCrazy »

MUCH better! Thanks again!
Going to just slip your name in under Author for a special thanks, is that alright?
User avatar
smurfier
Moderator
Posts: 1931
Joined: January 29th, 2010, 1:43 am
Location: Willmar, MN

Re: Changing width and height of bar with image

Post by smurfier »

Isn't a problem with me, but you did all the work.
GitHub | DeviantArt | Tumblr
This is the song that never ends. It just goes on and on my friends. Some people started singing it not knowing what it was, and they'll continue singing it forever just because . . .
User avatar
JpsCrazy
Posts: 667
Joined: April 18th, 2010, 2:16 pm
Location: NY, USA

Re: Changing width and height of bar with image

Post by JpsCrazy »

I'm just going to include a special thanks because you made the volume/progress bar possible and the !bangs instead of having so many measures (There's still a lot...) And well, you're the only person to actually help me with it.
And well, you've helped me countless times. I just think credit may be due.
User avatar
JpsCrazy
Posts: 667
Joined: April 18th, 2010, 2:16 pm
Location: NY, USA

Re: Changing width and height of bar with image

Post by JpsCrazy »

Alright, so now I'm attempting to use this for a vertical bar for another skin.

Code: Select all

[msCropMain]
	Measure=Calc
	Formula=ActualValue/MaxValue

[msCrop]
	Measure=Calc
	Formula=OriginalHeight*msCropMain

[mtBar]
	Meter=Image
	ImageCrop=0,0,OriginalWidth,[msCrop]
	ImageName=Image.png
	DynamicVariables=1
	W=NewWidth
	H=(NewHeight*[msCropMain])
This is close, but not exactly it.
It's well, for one, starting at the top and being cut off going down when I want it to start from the bottom and get cut off going up.
Secondly, I'm using it with #ScreenAreaHeight# and since that's quite large the slight variations from the norm are horribly noticeable, and a bit less 'slight'.

Also, is PreserveAspectRatio=1 a bad idea with this? I don't know if it's the whole height instead of width difference or just the effects of the code.
I just feel like it'll end up completely changing the size while getting the actual value.