It is currently May 27th, 2024, 6:14 pm

## Thread for help with the Shape meter

Get help with creating, editing & fixing problems with skins
Yincognito
Rainmeter Sage
Posts: 7341
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

### Re: Thread for help with the Shape meter

death.crafter wrote: June 5th, 2021, 12:31 pmUmm... I guess I misunderstood the context... He wanted a trapezoid for his perspective and your solution only keeps the parallel sides centered along an axis. By proportions I meant the position of the smaller parallel line.
Ah, you mean positioning the smaller parallel line (the BarMinHeight one) higher or lower, to simulate a perspective bar seen from different "altitude" angles, similar to a 3D model? Hmm... I doubt the OP had that kind of complexity in mind, but either way, this could in theory be achievable, but obviously it woud complicate a bit the implementation. It would also complicate your method of achieving this as well, because you'd have to similarly take into account that "altitude" / "altitude" angle (for both the frame / placeholder and the actual progress, see below).

In my samples, I assumed the most simple case, where the observer is at 0 degrees of altitude compared to the "vertical middle" of the frame / placeholder (like placing your eye at the vertical middle of a piece of paper that you place into perspective, i.e. rotate against the horizon plane, depending on which "wall" / "floor" you want it to be).
death.crafter wrote: June 5th, 2021, 12:31 pmI didn't understand the second part though. Why would you need formula for a static trapezoid?
It's only the frame / placeholder (i.e. the green trapezoid in my samples) that is static, with its position, ratios, edge lengths staying the same. The actual progress shape (i.e. the red trapezoid in my samples) has the length of some of its edges / sides always fluctuating, based on what progress value it's representing. In my last code, for example, the "heights" (both the min and max) of the progress trapezoid are always changing (e.g. 0 when progress is 0%, half their original height when progress is 50% and so on). You can't set the path of such a trapezoid without using a formula that takes the progress value into account - that's the whole point of a progress "bar" (well, trapezoid in this case). A Bar meter would indeed spare the user of having to use a formula for this since it does the percentage computing in the background, but naturally due to the Bar meter's limitations in this specific case (e.g. you can't make it a trapezoid instead of a rectangle), you'd have to compute some stuff "manually".

...
That being said, it's true that my samples used only the "vertical progress bar" model. To be honest, I didn't realize it, but changing to a "horizontal progress bar" appearance shouldn't be that hard. It's a similar case of swapping some variables and formulas. Of course, I didn't yet quite get which "wall" the OP is talking about when positioning the perspective shape (nor the orientation, for that matter), so I just picked a random case (like the right wall and vertical progress bar orientation) to represent.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
death.crafter
Rainmeter Sage
Posts: 1398
Joined: April 24th, 2021, 8:13 pm

### Re: Thread for help with the Shape meter

Yincognito wrote: June 5th, 2021, 12:06 pm not to mention you wouldn't be able to avoid using some kind of formula to draw the actual progress "mask" / container (as it's a function of the [Progress] value anyway)
This is the part but anyway, here is what I had in mind:
Screenshot 2021-06-05 191138.png
Code:

Code: Select all

``````[Rainmeter]
Update=50
AccurateText=1

[Measure]
Measure=Loop
StartValue=0
EndValue=100
Increment=1

[Trapezoid]
Meter=Shape
Shape=Path Path1 | Fill Color 000000
Path1=0,30 | LineTo 0,80 | LineTo 140,120 | LineTo 140,0 | ClosePath 1

[ProgressBar]
Meter=Shape
Shape=Rectangle 0,0,140,120 | Fill Color FFFFFF
Shape2=Rectangle 0,0,(140*[Measure]/100),120 | Fill Color FF0000
DynamicVariables=1
Container=Trapezoid
``````
You do not have the required permissions to view the files attached to this post.
from the Realm of Death
CodeCode
Posts: 1370
Joined: September 7th, 2020, 2:24 pm
Location: QLD, Australia

### Re: Thread for help with the Shape meter

death.crafter wrote: June 5th, 2021, 1:45 pm This is the part but anyway, here is what I had in mind:

Screenshot 2021-06-05 191138.png

Code:

Code: Select all

``````[Rainmeter]
Update=50
AccurateText=1

[Measure]
Measure=Loop
StartValue=0
EndValue=100
Increment=1

[Trapezoid]
Meter=Shape
Shape=Path Path1 | Fill Color 000000
Path1=0,30 | LineTo 0,80 | LineTo 140,120 | LineTo 140,0 | ClosePath 1

[ProgressBar]
Meter=Shape
Shape=Rectangle 0,0,140,120 | Fill Color FFFFFF
Shape2=Rectangle 0,0,(140*[Measure]/100),120 | Fill Color FF0000
DynamicVariables=1
Container=Trapezoid
``````
Hey death.crafter.
This is what I had i mind. I appreciate the help. I think I can make my bar(s) from this, quite nicely.
ƈǟռ'ȶ ʄɨӼ ɨȶ ɨʄ ɨȶ ǟɨռ'ȶ ɮʀօӄɛ - ʊռʟɛֆֆ ɨȶ ɨֆ ɨռ ƈօɖɛ.
death.crafter
Rainmeter Sage
Posts: 1398
Joined: April 24th, 2021, 8:13 pm

### Re: Thread for help with the Shape meter

CodeCode wrote: June 5th, 2021, 1:51 pm Hey death.crafter.
This is what I had i mind. I appreciate the help. I think I can make my bar(s) from this, quite nicely.
Hey Code. Glad I could be of help.
from the Realm of Death
Yincognito
Rainmeter Sage
Posts: 7341
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

### Re: Thread for help with the Shape meter

death.crafter wrote: June 5th, 2021, 1:45 pm This is the part but anyway, here is what I had in mind:

Screenshot 2021-06-05 191138.png

Code:

Code: Select all

``````[Rainmeter]
Update=50
AccurateText=1

[Measure]
Measure=Loop
StartValue=0
EndValue=100
Increment=1

[Trapezoid]
Meter=Shape
Shape=Path Path1 | Fill Color 000000
Path1=0,30 | LineTo 0,80 | LineTo 140,120 | LineTo 140,0 | ClosePath 1

[ProgressBar]
Meter=Shape
Shape=Rectangle 0,0,140,120 | Fill Color FFFFFF
Shape2=Rectangle 0,0,(140*[Measure]/100),120 | Fill Color FF0000
DynamicVariables=1
Container=Trapezoid
``````
Nice, and good work! Two things though:
- you still used a formula in one of the meters, just like I mentioned (either the container or the other one)
- your method won't work so easily if the orientation of the progress bar would be vertical, because as you can see here, the progress' upper edge is not always horizontal in such a case due to how perspective works (meaning that using rectangles won't cut it there)

Basically, you'd need additional formulas to make the sample work for other cases, irrespective of the method chosen for implementation - that was my point. The difference between our approaches, apart from using a container or not, is that you used hardcoded based values as path points, while I used variables. The former looks simpler and the latter is more flexible. Personally, I prefer flexibility, since I'm not a fan of doing or redoing thing more times than strictly necessary (e.g. if I wanted to change the edges' length in your case I would have to recalculate the path points, while in my case modifying the variable values would have done it).

That being said, it's up to the OP which method is better suited for his case. If he's happy with any of these ways, then it's all good from my point of view.

P.S. Thanks for providing a sample code for your method - sometimes is harder to understand visually related stuff just from words. Now I understand eactly what you meant earlier.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
death.crafter
Rainmeter Sage
Posts: 1398
Joined: April 24th, 2021, 8:13 pm

### Re: Thread for help with the Shape meter

Yincognito wrote: June 5th, 2021, 2:47 pm Nice, and good work! Two things though:
- your method won't work so easily if the orientation of the progress bar would be vertical, because as you can see
Yes the vertical thing ain't possible with this approach. So it's less flexible. A lot.
from the Realm of Death
Yincognito
Rainmeter Sage
Posts: 7341
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

### Re: Thread for help with the Shape meter

death.crafter wrote: June 5th, 2021, 1:45 pmThis is the part but anyway, here is what I had in mind[...]
Building on the base of your code, a shorter version without any container:

Code: Select all

``````[Rainmeter]
Update=50
AccurateText=1

[Measure]
Measure=Loop
StartValue=0
EndValue=100
Increment=1

[Trapezoid]
Meter=Shape
Shape=Path Path1 | Fill Color FFFFFF
Path1=0,30 | LineTo 0,80 | LineTo 140,120 | LineTo 140,0 | ClosePath 1
Shape2=Path Path2 | Fill Color FF0000
Path2=0,30 | LineTo 0,80 | LineTo (140*[Measure]/100),(80+40*[Measure]/100) | LineTo (140*[Measure]/100),(30-30*[Measure]/100)
DynamicVariables=1
``````
Trapezoid Progress - Method II.jpg
I believe this retains some flexibility because it doesn't depend on rectangle shapes, one can modify the formulas freely.

Yes, formulas and variables make an option line a bit longer, unfortunately. This has the effect of making things look more complicated than they really are.
You do not have the required permissions to view the files attached to this post.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
death.crafter
Rainmeter Sage
Posts: 1398
Joined: April 24th, 2021, 8:13 pm

### Re: Thread for help with the Shape meter

Yincognito wrote: June 5th, 2021, 3:10 pm Building on the base of your code, a shorter version without any container:

Code: Select all

``````[Rainmeter]
Update=50
AccurateText=1

[Measure]
Measure=Loop
StartValue=0
EndValue=100
Increment=1

[Trapezoid]
Meter=Shape
Shape=Path Path1 | Fill Color FFFFFF
Path1=0,30 | LineTo 0,80 | LineTo 140,120 | LineTo 140,0 | ClosePath 1
Shape2=Path Path2 | Fill Color FF0000
Path2=0,30 | LineTo 0,80 | LineTo (140*[Measure]/100),(80+40*[Measure]/100) | LineTo (140*[Measure]/100),(30-30*[Measure]/100)
DynamicVariables=1
``````
Trapezoid Progress - Method II.jpg
I believe this retains some flexibility because it doesn't depend on rectangle shapes, one can modify the formulas freely.

Yes, formulas and variables make an option line a bit longer, unfortunately. This has the effect of making things look more complicated than they really are.
My point wasn't use of variables at all... My point was the position of the smaller parallel bar, which ,like you said, matters when altitude is considered. And that can be taken care of another offset variable, i.e. going by your way.

But I prefer as less variables as possible. Because the less variables to parse the more efficient(talking about dynamic skins like visualizers, others are just fine with them).
from the Realm of Death
Yincognito
Rainmeter Sage
Posts: 7341
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

### Re: Thread for help with the Shape meter

death.crafter wrote: June 5th, 2021, 3:41 pm My point wasn't use of variables at all... My point was the position of the smaller parallel bar, which ,like you said, matters when altitude is considered. And that can be taken care of another offset variable, i.e. going by your way.
Yes, indeed. You didn''t mention the altitude in your last reply (though it was obvious from the code, on a closer look), thus the misunderstanding. My bad.
death.crafter wrote: June 5th, 2021, 3:41 pmBut I prefer as less variables as possible. Because the less variables to parse the more efficient(talking about dynamic skins like visualizers, others are just fine with them).
Visualisers take more CPU than other skin types anyway, even if one doesn't use variables (I spent quite some time trying to squeeze as much CPU usage as I could when working on my own visualizer skin, before realizing the CPU usage effect is inherent to such a skin and didn't depend too much on the other tricks I was using to alleviate it). Sure, variables add to the already higher CPU usage due to the nature of the skin, but just like dynamic variables by themselves (or even the update rates), they are not a problem on their own. You only have to be careful not to combine all these potential "CPU hogs" in one place, that's all.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
CodeCode
Posts: 1370
Joined: September 7th, 2020, 2:24 pm
Location: QLD, Australia

### Re: Thread for help with the Shape meter

Hello,
SO things are progressing nicely, thanks to help here.

The new question is this formula:
(308*[Measure]/100)
It works from left to right. And as I am really doing both sides of the display (The geometry seems fin so far...). And it makes a lot of sense for both sides to go in the same direction, in higher percentiles.
How would the formula work in that case?

I tried a couple things and it broke the bar, as in it simply was gone. Hopefully it wont require mapping the trapezoids again, but actually that wouldn't be very difficult, since the numbers are the same just ordered differently.

Thanks.
CC
ƈǟռ'ȶ ʄɨӼ ɨȶ ɨʄ ɨȶ ǟɨռ'ȶ ɮʀօӄɛ - ʊռʟɛֆֆ ɨȶ ɨֆ ɨռ ƈօɖɛ.