It is currently April 20th, 2024, 2:18 pm

Thread for help with the Shape meter

Get help with creating, editing & fixing problems with skins
User avatar
balala
Rainmeter Sage
Posts: 16148
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Thread for help with the new Shape meter

Post by balala »

raiguard wrote: October 15th, 2018, 4:07 pm Can you actually let me know if it works for you?
It seems that at least up to now, the Moon's icon is all right. Both are ok: the illuminated percent and the rotation angle.
Will continue to test the code for at least a few days, or even better for a month from now.
Good work, congratulations. :thumbup: I tried once something similar with your rotation, but I succeeded than only partially. Didn't work always for any moment and location and when it did, wasn't perfect.
User avatar
raiguard
Posts: 660
Joined: June 25th, 2015, 7:02 pm
Location: The Sky, USA

Re: Thread for help with the new Shape meter

Post by raiguard »

balala wrote: October 16th, 2018, 3:46 pm It seems that at least up to now, the Moon's icon is all right. Both are ok: the illuminated percent and the rotation angle.
Will continue to test the code for at least a few days, or even better for a month from now.
Good work, congratulations. :thumbup: I tried once something similar with your rotation, but I succeeded than only partially. Didn't work always for any moment and location and when it did, wasn't perfect.
Thanks! As it turns out, today the moon only rises but doesn't set, so that actually crashed my script! I hate working with astronomical calculations... :headbang:

Anyway, I made some tweaks to the finished shape. With how small the moon shape is in my Weather Meter, it became very apparent that it wasn't actually showing a quarter as "half" of the moon being filled in. Because of StrokeWidth, it was actually showing a disproportionately large amount of the moon being filled in, when compared to the empty half.

The new shape has a few key differences as compared to the original: first, it uses a solid background rather than an empty outline to represent the dim side of the moon. Second, the path shape is reversed to draw the lit section of the moon, rather than drawing the empty one.

Here's the new icon:
moon.gif
Here's the updated example code:

Code: Select all

[Rainmeter]
MiddleMouseUpAction=[!Refresh]
AccurateText=1

[Variables]
; Moon phase value: 0.0 (new) - 0.5 (full) - 1.0 (new)
moonPhase=0.08
; Radius of moon shape
moonRadius=30
moonIlluminationAngle=-131
showMoonAngle=1
moonColor=200,200,200
bgColor=15,15,15
moonBgColor=50,50,50

; Converts the moon phase value into a radius value usable by the arc shape
[MeasureMoonShapePhaseCalc]
Measure=Calc
Formula=clamp(abs((#moonRadius# * 4 * ((#moonPhase# > 0.5) ? (0.5 - (#moonPhase# - 0.5)) : #moonPhase#)) - #moonRadius#),0,#moonRadius#)
DynamicVariables=1

[MeterMoonShape]
Meter=Shape
Shape=Ellipse #moonRadius#,#moonRadius#,#moonRadius#,#moonRadius# | StrokeWidth 1 | Stroke Color #moonBgColor# | Fill Color #moonBgColor#
Shape2=Path MoonArc | StrokeWidth 0 | Stroke Color #moonColor# | Fill Color #moonColor# | Rotate ((#showMoonAngle# = 1) ? (-#moonIlluminationAngle#) : ((#moonPhase# > 0.5) ? -90 : 90)),#moonRadius#,#moonRadius# | StrokeLineJoin Bevel
MoonArc=0,#moonRadius# | ArcTo (#moonRadius# * 2),#moonRadius#,#moonRadius#,[MeasureMoonShapePhaseCalc:],0,(((#moonPhase# > 0.25) && (#moonPhase# < 0.75)) ? 1 : 0) | ArcTo 0,#moonRadius#,#moonRadius#,#moonRadius#,0,1
SolidColor=#bgColor#
Padding=10,10,10,10
X=50
Y=50
DynamicVariables=1
LeftMouseUpAction=[!CommandMeasure MeasureMoonShapeActionTimer "Execute 1"]

; Temporary measure for debug purposes - animates between new moon and full moon, then back
[MeasureMoonShapeActionTimer]
Measure=Plugin
Plugin=ActionTimer
ActionList1=Repeat Increase, 16, 100 | Wait 1000 | Repeat Increase, 16, 100 | Reset
Increase=[!SetVariable moonPhase "(#moonPhase# + 0.005)"][!UpdateMeasure MeasureMoonShapePhaseCalc][!UpdateMeter MeterMoonShape][!UpdateMeasure MeasureMoonShapeActionTimer][!Redraw]
Reset=[!SetVariable moonPhase 0][!UpdateMeasure MeasureMoonShapePhaseCalc][!UpdateMeter MeterMoonShape][!UpdateMeasure MeasureMoonShapeActionTimer][!Redraw]
DynamicVariables=1
You do not have the required permissions to view the files attached to this post.
”We are pretty sure that r2922 resolves the regression in resolution caused by a reversion to a revision.” - jsmorley, 2017
User avatar
balala
Rainmeter Sage
Posts: 16148
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Thread for help with the new Shape meter

Post by balala »

raiguard wrote: October 17th, 2018, 3:59 am Thanks! As it turns out, today the moon only rises but doesn't set, so that actually crashed my script!
Besides this, even if the Moon rises and sets, there are some other issues, too. Yesterday in daytime after the refresh, a single Invalid TimeStampFormat: %H:%M error message was shown related to [MeasureSunCalcDayLength] measure, but after Sunset this message was shown on every update cycle.
There is something wrong with the .lua code, I think. I had no time yet to try to figure out what, but there something is not ok.
Today the message mentioned by you is shown.
User avatar
Yincognito
Rainmeter Sage
Posts: 7131
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Thread for help with the new Shape meter

Post by Yincognito »

Is there a better way of making a linear gradient filled bevel-type background than this? I tried this since BevelType=1 became too thick for my needs lately.

Code: Select all

[MT_Rainmeter_Shape]
Meter=Shape
Shape=Rectangle 0,0,#SkinWidth#,#SkinHeight# | StrokeWidth 0 | Fill LinearGradient SkinGradient
SkinGradient=#SkinGradientAngle# | #SkinSolidColor# ; 0.0 | #SkinSolidColor2# ; 1.0
Shape2=Line 0,0,#SkinWidth#,0 | StrokeWidth #SkinMargin# | Stroke Color 255,255,255,255
Shape3=Line #SkinWidth#,0,#SkinWidth#,#SkinHeight# | StrokeWidth #SkinMargin# | Stroke Color 32,32,32,255
Shape4=Line #SkinWidth#,#SkinHeight#,0,#SkinHeight# | StrokeWidth #SkinMargin# | Stroke Color 32,32,32,255
Shape5=Line 0,#SkinHeight#,0,0 | StrokeWidth #SkinMargin# | Stroke Color 255,255,255,255
I tried to do this using a Path, but apparently it doesn't allow to set the color of each LineTo segment individually (or maybe I don't know how to do it)...

Note: the variables are self explanatory, so I let them as they were, without replacing them with hardcoded values.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5402
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Thread for help with the new Shape meter

Post by eclectic-tech »

Since the [Rainmeter] Bevel=1 uses the same light color for the left and top lines, and the same darker color for the right and bottom, you could use PATH to simplify the code slightly.

Code: Select all

[Variables]
SkinWidth=100
SkinHeight=100
SkinGradientAngle=60
SkinSolidColor=32,32,32
SkinSolidColor2=240,240,240
SkinMargin=0.75

[MT_Rainmeter_Shape]
Meter=Shape
X=(Clamp(#SkinMargin#,1,#SkinMargin#/2))
Y=(Clamp(#SkinMargin#,1,#SkinMargin#/2))

Shape=Rectangle 0,0,#SkinWidth#,#SkinHeight# | StrokeWidth 0 | Fill LinearGradient SkinGradient
SkinGradient=#SkinGradientAngle# | #SkinSolidColor# ; 0.0 | #SkinSolidColor2# ; 1.0

Shape2=Path UpAndRight | StrokeWidth #SkinMargin# | Stroke Color 255,255,255,255
UpAndRight=0,#SkinHeight# | LineTo 0,0 | LineTo #SkinWidth#,0

Shape3=Path DownAndLeft | StrokeWidth #SkinMargin# | Stroke Color 32,32,32,255
DownAndLeft=#SkinWidth#,0 | LineTo #SkinWidth#,#SkinHeight# | LineTo 0,#SkinHeight#
If you want individual colors for each side, then I think your original code is the way to go. :thumbup:

EDIT: Modified the code to prevent clipping of the margin at the top and left sides by clamping the X & Y shape positions to a minimum of 1 pixel up to half the #SkinMargin# value. Strokes are drawn half inside and half outside the shape parameters.
User avatar
Yincognito
Rainmeter Sage
Posts: 7131
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Thread for help with the new Shape meter

Post by Yincognito »

eclectic-tech wrote: December 23rd, 2018, 9:05 pm Since the [Rainmeter] Bevel=1 uses the same light color for the left and top lines, and the same darker color for the right and bottom, you could use PATH to simplify the code slightly.
Yes, this is what I was looking for - many thanks. I don't know why defining two paths instead of just one never crossed my mind, after all, it did when doing this with Line shapes...

I don't think using Clamp for X and Y is desirable in my case, since clipping is sometimes appropriate for the lighter color, reducing line's brightness and giving the impression of the same thickness as the darker color. In white and black scenarios, if you let the white lines have the same thickness as the black ones, the impression on the eye is that the white lines are thicker (since they are much brighter). I very much like the default Rainmeter behavior in this case - setting X and Y to 0 works just fine.

Side Note: I tried using your Clamp model, and while it doesn't clip the top & left side margins, it looks like it clips the bottom & right side margins, making the lines there not visible (probably outside the skin area) when I set #SkinMargin# to 2, for example. So, one more reason to let X and Y at 0.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5402
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Thread for help with the new Shape meter

Post by eclectic-tech »

Yes, I didn't look at every possibility when I suggested the Clamp; I should have considered incorporating it into the shape also to prevent the clipping you are seeing, my bad! :uhuh:
Just wanted to mention that positioning is necessary to prevent clipping strokes, especially at the left and top.

Edit: I am not seeing that clipping, but I also do NOT have the SkinWidth and SkinHeight defined in the [Rainmeter] section; which would then clip the right and bottom like you are seeing.
bevel1.png
You do not have the required permissions to view the files attached to this post.
User avatar
Yincognito
Rainmeter Sage
Posts: 7131
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Thread for help with the new Shape meter

Post by Yincognito »

eclectic-tech wrote: December 23rd, 2018, 10:51 pm Yes, I didn't look at every possibility when I suggested the Clamp; I should have considered incorporating it into the shape also to prevent the clipping you are seeing, my bad! :uhuh:
Just wanted to mention that positioning is necessary to prevent clipping strokes, especially at the left and top.

Edit: I am not seeing that clipping, but I also do NOT have the SkinWidth and SkinHeight defined in the [Rainmeter] section; which would then clip the right and bottom like you are seeing.bevel1.png
That's ok, the important thing is that it works as it is supposed to do, in both your case and mine. It's the idea that I was looking for, as for the rest, I can easily tweak it as desired.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
Slim08
Posts: 23
Joined: October 8th, 2018, 4:38 pm

Re: Thread for help with the new Shape meter

Post by Slim08 »

Hi and happy new year everybody. Can someone tell me if there is a way to make a shape (other than a rectangle) with the FrostedGlass plugin wihout this weird looking triangles sticking out on the sides where normally nothing is supposed to be?

Image

Code: Select all

[Rainmeter]
OnRefreshAction=[!Move "[MeasureX]" "[MeasureY]"]
Update=-1

[Metadata]
Author=Slim08
AppVersion=v1.2

[Variables]
dockwidth=(1479 + 16)
;+57 pro Icon
dockhight=21

[FrostedGlass]
Measure=Plugin
Plugin=FrostedGlass
Type=Blur
;Type=Acrylic
Border=None

[MeterShape]
Meter=Shape
X=1
Y=1
Shape=Path MyPath | Extend MyModifiers1
MyPath=0,(#dockhight# - 5) | LineTo 10,-1 | LineTo (#dockwidth# - 10),-1 | LineTo (#dockwidth#),(#dockhight# - 5)
Shape2=Rectangle 0,(#dockhight# - 5),#dockwidth#,5 | Extend MyModifiers1
Shape3=Combine Shape | Union Shape2
Shape4=Rectangle 0,(#dockhight# - 5),#dockwidth#,5 | Extend MyModifiers2
Shape5=Rectangle 0,(#dockhight# - 4),#dockwidth#,1 | Extend MyModifiers3
Shape6=Rectangle 0,(#dockhight# - 3),#dockwidth#,2 | Extend MyModifiers4
Shape7=Rectangle 0,(#dockhight# - 1),#dockwidth#,1 | Extend MyModifiers5
MyModifiers1=Fill Color 200,200,200,80 | StrokeWidth 0
MyModifiers2=Fill Color 205,205,205,20 | StrokeWidth 0
MyModifiers3=Fill Color 155,155,155,10 | StrokeWidth 0
MyModifiers4=Fill Color 20,20,20,155 | StrokeWidth 0
MyModifiers5=Fill Color 0,0,0,155 | StrokeWidth 0

[MeasureX]
Measure=Calc
Formula=( #SCREENAREAWIDTH# - #CURRENTCONFIGWIDTH# ) / 2  - 1
DynamicVariables=1

[MeasureY]
Measure=Calc
Formula=( #SCREENAREAHEIGHT# - #CURRENTCONFIGHEIGHT# )
DynamicVariables=1
User avatar
qwerky
Posts: 182
Joined: April 10th, 2014, 12:31 am
Location: Canada

Re: Thread for help with the new Shape meter

Post by qwerky »

Hello World, apologies for such a simple question, but I have read through this entire thread and not found an answer.

Just learning the Shape meter, and very much appreciate the rectangle with rounded corners! But I do not quite understand the Line shape in this simple example:

Code: Select all

[Rainmeter]
Update=1000
AccurateText=1

[Variables]
colorBackground=0,0,191,255
colorTitleBar=0,16,64,255
colorDivider=200,200,200,255

[mtrBackground]
Meter=Shape
Shape=Rectangle 0,0,100,100,7 | StrokeWidth 0 | Fill Color #colorBackground#
Shape2=Rectangle 0,0,100,20,7 | StrokeWidth 0 | Fill Color #colorTitleBar#
Shape3=Rectangle 0,10,100,10 | StrokeWidth 0 | Fill Color #colorTitleBar#
AntiAlias=1
X=100
Y=100
W=100
H=100

[mtrDividers]
Meter=Shape
Shape=Line 20,20,20,99 | Extend DividerModifiers
Shape2=Line 23,20,23,100 | Extend DividerModifiers
Shape3=Line 40,0,40,99 | Extend DividerModifiers
Shape4=Line 43,0,43,100 | Extend DividerModifiers
DividerModifiers=StrokeWidth 2 | Stroke Color #colorDivider#
AntiAlias=1
X=100
Y=100
W=100
H=100

[mtrDividers2]
Meter=Shape
Shape=Rectangle 60,20,2,80 | Extend DividerModifiers
Shape2=Rectangle 63,20,2,81 | Extend DividerModifiers
Shape3=Rectangle 80,0,2,100 | Extend DividerModifiers
Shape4=Rectangle 83,0,2,99 | Extend DividerModifiers
DividerModifiers=StrokeWidth 0 | Fill Color #colorDivider#
AntiAlias=1
X=100
Y=100
W=100
H=100
In the second meter, the first line starts at the top of the main pane, directly below the title bar, and ends at what I think should be the bottom of that pane, but in fact is one pixel too short. The second line appears to end correctly, but why, since the skin/background is 100 pixels high, and therefore should extend from x=0 to x=99 (rather than 100)? The second pair of lines demonstrate the same, but beginning at the top of the skin/meter.

The third meter draws the lines using Rectangle, rather than Line, and in that case the lines seem to end correctly, as it is using a specified Height, rather than a specified End Y. What am I missing?