With the filter_drop_shadow()
drop shadow appears beneath the input image
or shape and its offset is controlled by dx
and dy
. The blurring of the
drop shadow is set by the stdev
value.
filter_drop_shadow(dx = 0.2, dy = 0.2, stdev = 1, color = "black", opacity = 1)
dx, dy | The offset of the drop shadow compared to the position of the input image or shape. |
---|---|
stdev | The number of standard deviations for the blur effect. |
color | The color of the drop shadow. |
opacity | The opacity of the drop shadow. We can use a real number from
|
# Apply a drop shadow filter on a # text element (orange in color, # and semi-opaque) SVG(width = 250, height = 100) %>% svg_filter( id = "shadow", filters = list( filter_drop_shadow( dx = 1, dy = 2, color = "orange", opacity = 0.5 ) ) ) %>% svg_text( x = 10, y = 40, text = "Shadowed", attrs = svg_attrs_pres( font_size = "2em", fill = "#555555", font_weight = "bolder", filter = "shadow" ) )#>#> #> #> #> #> #> #>