It is currently October 7th, 2022, 9:32 am

New Shape Meter

Changes made during the Rainmeter 4.0 beta cycle.
User avatar
fonpaolo
Moderator
Posts: 1387
Joined: April 11th, 2013, 8:08 pm
Location: Italy

Re: New Shape Meter

Post by fonpaolo »

I'm sorry to resurrect another old thread... :oops:
However, thanks to wxdata loss and the consequent need to fix my weather skin(s), now, I finally try to finish what I left aside for the last two years.

...and there the problems arise!

How can I "draw" a hole in a shape meter?

Code: Select all

[ShapeTest]
Meter=Shape
Shape=Ellipse 0,0,([MeasureMagnitude]*3.5) | StrokeWidth 0 | Fill RadialGradient GradientGlow
Shape2=Ellipse 0,0,([MeasureMagnitude]*1.5) | StrokeWidth 1 | Stroke Color 255,0,0,200 | Fill Color 255,0,0,140
GradientGlow=0,0 | 165,250,245,160 ; 0.0 | 165,250,245,50 ; 1.0
x=20
y=30
DynamicVariables=1
I'm probably thinking wrong, do I have to "cut" the hole using Combine and XOR by subtracting another shape?

All I want is to draw a glow outside the Shape2 shape, to be clear, the order of shapes could be reversed, Shape2 is the main shape.
User avatar
jsmorley
Developer
Posts: 22547
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: New Shape Meter

Post by jsmorley »

fonpaolo wrote: April 17th, 2020, 12:53 pm I'm sorry to resurrect another old thread... :oops:
However, thanks to wxdata loss and the consequent need to fix my weather skin(s), now, I finally try to finish what I left aside for the last two years.

...and there the problems arise!

How can I "draw" a hole in a shape meter?

Code: Select all

[ShapeTest]
Meter=Shape
Shape=Ellipse 0,0,([MeasureMagnitude]*3.5) | StrokeWidth 0 | Fill RadialGradient GradientGlow
Shape2=Ellipse 0,0,([MeasureMagnitude]*1.5) | StrokeWidth 1 | Stroke Color 255,0,0,200 | Fill Color 255,0,0,140
GradientGlow=0,0 | 165,250,245,160 ; 0.0 | 165,250,245,50 ; 1.0
x=20
y=30
DynamicVariables=1
I'm probably thinking wrong, do I have to "cut" the hole using Combine and XOR by subtracting another shape?

All I want is to draw a glow outside the Shape2 shape, to be clear, the order of shapes could be reversed, Shape2 is the main shape.
I'm not entirely clear what you are going for, but yes, I think you are going to want to use Combine, with Exclude or XOR.

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1

[Variables]

[ShapeCombine]
Meter=Shape
X=100
Y=100
Shape=Ellipse 0,0,100 | StrokeWidth 0 | Stroke Color 255,0,0,200 | Fill RadialGradient MyGradient
Shape2=Ellipse 0,0,50 | StrokeWidth 0
Shape3=Combine Shape | Exclude Shape2
MyGradient=0,0 | 255,0,0,255 ; 0.0 | 255,0,0,1 ; 1.0

1.jpg
You do not have the required permissions to view the files attached to this post.
User avatar
eclectic-tech
Rainmeter Sage
Posts: 4837
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: New Shape Meter

Post by eclectic-tech »

Or using your colors and a [MeasureMagnitude] you can get an changing blue hole...


bluehole.gif

Code: Select all

[MeasureMagnitude]
Measure=Calc
Formula=Random
LowBound=2
HighBound=10
DynamicVariables=1

[ShapeTest]
Meter=Shape
; If the shape changes dimensions, the initial X & Y positions must be set to prevent clipping the largest possible shape
; (10 * 3.5 = 35) so 40 is used
X=40
Y=40
Shape=Ellipse 0,0,([MeasureMagnitude]*3.5) | StrokeWidth 0 | Fill RadialGradient GradientGlow
Shape2=Ellipse 0,0,([MeasureMagnitude]*1.5) | StrokeWidth 1 | Stroke Color 255,0,0,200 | Fill Color 255,0,0,140
Shape3=Combine Shape | XOR Shape2
GradientGlow=0,0 | 165,250,245,160 ; 0.0 | 165,250,245,50 ; 1.0
DynamicVariables=1

[MeterString]
Meter=String
MeasureName=MeasureMagnitude
X=40
Y=90
FontColor=165,250,245
StringAlign=CenterCenter
You do not have the required permissions to view the files attached to this post.
User avatar
Yincognito
Rainmeter Sage
Posts: 4806
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: New Shape Meter

Post by Yincognito »

Another idea that can be "blended" with jsmorley's is to create a Path shape around the "hole", and then using the same radial gradient to fill it accordingly. This is probably more suited if the "hole" is highly irregular in shape (like a closed combination of arcs, curves and straight lines, for example).

I don't know if combining shapes is really needed when doing this for a glow effect though. Maybe I'm mistaken, but unless you want the combined shape to color, move or rotate its "parts" all at the same time in an animation (when combining shapes is probably needed), simply setting the color(s) of the path around the "hole" to transparent using the alpha channel or to opaque when "glowing" using some dynamic variables should be enough in, say, a hovered glowing "buttons" scenario.
User avatar
jsmorley
Developer
Posts: 22547
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: New Shape Meter

Post by jsmorley »

I would suggest getting and examining this suite of Shape meter examples to see some of the capabilities.

https://docs.rainmeter.net/manual/examples/ExamplesMeterShape.rmskin
User avatar
fonpaolo
Moderator
Posts: 1387
Joined: April 11th, 2013, 8:08 pm
Location: Italy

Re: New Shape Meter

Post by fonpaolo »

Thanks, I'm trying to get back to work on Rainmeter, there are many things that I left halfway through and this shape meter is one of the most difficult, even then, let alone now...

At that time I was experimenting and trying to replace images with shapes, but I gave up on it almost immediately.
Even inkscape, the first program that gave me a hard time ... or maybe it's me, now. O.O
User avatar
jsmorley
Developer
Posts: 22547
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: New Shape Meter

Post by jsmorley »

fonpaolo wrote: April 17th, 2020, 3:22 pm Thanks, I'm trying to get back to work on Rainmeter, there are many things that I left halfway through and this shape meter is one of the most difficult, even then, let alone now...

At that time I was experimenting and trying to replace images with shapes, but I gave up on it almost immediately.
Even inkscape, the first program that gave me a hard time ... or maybe it's me, now. O.O
There is a lot to the Shape meter, and unless you are familiar with doing stuff with vector graphics, like in Illustrator or Inkscape, it can have a bit of a learning curve. My advice is to just jump in with both feet and try things. Use the examples I linked to above as a starting point. If you can wrap your head around it, the Shape meter is very, very powerful indeed, and you can do some pretty neat and creative things with it.

The basics are not hard at all. It can get a bit more daunting when you get to bézier curves and such.
User avatar
fonpaolo
Moderator
Posts: 1387
Joined: April 11th, 2013, 8:08 pm
Location: Italy

Re: New Shape Meter

Post by fonpaolo »

Yes and no...
At that time I was experimenting, but, even the simplest image requires a real novel and if you have more images... O.O

I tried to convert some basic images with Inkscape, only one color and no background, it thought for an eternity and then the result was very disappointing.
Thinking about recreating again all the images as vectors is completely out of the question. :headbang:
User avatar
jsmorley
Developer
Posts: 22547
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: New Shape Meter

Post by jsmorley »

I don't see the Shape meter as any kind of replacement for using images. The name of the meter should be illustrative about the intent. CAN you replace just about any image with Shape meter(s)? Yeah, I guess so.

MonaLisa_1.0.rmskin
1.jpg


Is it "easy" or "efficient" to do so? Certainly not in all cases. Vector and rastor graphics have a completely different approach and intent. There is a fundamental difference between "paint" and "draw". Doing the Mona Lisa as thousands of Shape meters is fun, but stupid...

The right tool for the right job. Some things just make the most sense as an "image", some things lend themselves to a symbol-based "font", and some are good candidates for "shapes".
You do not have the required permissions to view the files attached to this post.
User avatar
fonpaolo
Moderator
Posts: 1387
Joined: April 11th, 2013, 8:08 pm
Location: Italy

Re: New Shape Meter

Post by fonpaolo »

I know the difference.
I thought of using Shape meter to be able to change the size of the skins without the consequent problems given by the images.