It is currently February 6th, 2023, 6:50 pm

Suggestion: A simple way to add Shadows to shapes

Report bugs with the Rainmeter application and suggest features.
User avatar
Cariboudjan
Posts: 251
Joined: May 12th, 2019, 8:55 am

Suggestion: A simple way to add Shadows to shapes

Post by Cariboudjan »

I would love for there to be a simple way to add shadows to shapes with a "Shadow [X],[Y],[W],[H]" and "ShadowColor [Color],[Opacity]" parameter.
Annotation 2022-08-19 153704.png
You do not have the required permissions to view the files attached to this post.
User avatar
eclectic-tech
Rainmeter Sage
Posts: 4948
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Suggestion: A simple way to add Shadows to shapes

Post by eclectic-tech »

Cariboudjan wrote: August 19th, 2022, 9:40 pm I would love for there to be a simple way to add shadows to shapes with a "Shadow [X],[Y],[W],[H]" and "ShadowColor [Color],[Opacity]" parameter.
This can be done by adding a 'shadow' shape as the first shape in a multi-shape meter and using an Offset transformation parameter.
You can control the size, position, color, and opacity of the 'shadow' using variables or hard coded in the 'shadow' Shape definition.

The shapes will be drawn and layered according to the Shape# (bottom to topmost).
Note: Do Not use 'Combine' on the shape meter; this removes the attributes for additional numbered shapes.

A simple rectangle example with a shadow.

Code: Select all

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

[Variables]
StrokeWidth=3
ShadowOffsetX=12
ShadowOffsetY=16
ShadowColor=0,40,0,80

[MeasureTime]
Measure=Time
Format=%H:%M

[Background]
Meter=Shape
; Offset the shapes to prevent clipping of the left & top strokes
X=(Ceil(#StrokeWidth#*0.5))
Y=(Ceil(#StrokeWidth#*0.5))

; Shadow Shape ~ matches background shape dimensions
Shape=Rectangle 0,0,240,120,20 | StrokeWidth 0 | Fill Color #ShadowColor# | Offset #ShadowOffsetX#,#ShadowOffsetY#

; Background Shape
Shape2=Rectangle 0,0,240,120,20 | StrokeWidth #StrokeWidth# | Stroke Color 255,255,255 | Fill Color 80,210,120,250
AntiAlias=1

[MeterTime]
MeasureName=MeasureTime
Meter=STRING
X=(240*0.5)
Y=(120*0.55)
FontSize=60
FontColor=255,255,255
StringAlign=CENTERCENTER
StringStyle=Bold
AntiAlias=1
shadow1.png
You do not have the required permissions to view the files attached to this post.
User avatar
Cariboudjan
Posts: 251
Joined: May 12th, 2019, 8:55 am

Re: Suggestion: A simple way to add Shadows to shapes

Post by Cariboudjan »

Oh, I know - But you won't get the nice drop shadow blur effect. Currently there is no way to create a "fuzzy" stroke edge on a shape. A parameter that would allow you to add a shadow would be really useful, without any need to create a duplicate shape in a certain order.
User avatar
eclectic-tech
Rainmeter Sage
Posts: 4948
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Suggestion: A simple way to add Shadows to shapes

Post by eclectic-tech »

Cariboudjan wrote: November 16th, 2022, 1:46 pm Oh, I know - But you won't get the nice drop shadow blur effect. Currently there is no way to create a "fuzzy" stroke edge on a shape. A parameter that would allow you to add a shadow would be really useful, without any need to create a duplicate shape in a certain order.
I agree that this method doesn't produce the best shadow effect and that you were probably already aware of that :oops: :rosegift:

Hopefully, the DevTeam can take a look at your suggestion and give us a real shadow effect on shapes :great:
User avatar
SilverAzide
Rainmeter Sage
Posts: 2250
Joined: March 23rd, 2015, 5:26 pm

Re: Suggestion: A simple way to add Shadows to shapes

Post by SilverAzide »

Cariboudjan wrote: November 16th, 2022, 1:46 pm Oh, I know - But you won't get the nice drop shadow blur effect. Currently there is no way to create a "fuzzy" stroke edge on a shape. A parameter that would allow you to add a shadow would be really useful, without any need to create a duplicate shape in a certain order.
You can do fuzzy shapes! It's kind of a lame work-around, but it works nearly perfectly. Just take that shadow, set it to black with the alpha set to something like -- I don't know -- say 16, or maybe 8. Then do overlapping background images offset by one pixel to the left and top. After a few overlaps, you'll have a pretty good shadow effect.

Edit: Oops, I see where you said you don't want to do this. Sorry... :oops: It does work tho.
Screenshot 2022-11-16 203058.png
You do not have the required permissions to view the files attached to this post.
Gadgets Wiki GitHub More Gadgets...
User avatar
Cariboudjan
Posts: 251
Joined: May 12th, 2019, 8:55 am

Re: Suggestion: A simple way to add Shadows to shapes

Post by Cariboudjan »

SilverAzide wrote: November 16th, 2022, 7:45 pm You can do fuzzy shapes! It's kind of a lame work-around, but it works nearly perfectly. Just take that shadow, set it to black with the alpha set to something like -- I don't know -- say 16, or maybe 8. Then do overlapping background images offset by one pixel to the left and top. After a few overlaps, you'll have a pretty good shadow effect.

Edit: Oops, I see where you said you don't want to do this. Sorry... :oops: It does work tho.
Screenshot 2022-11-16 203058.png
Neat trick!