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)

Arguments

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 0 to 1 or a value in percentage units.

Examples

# 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" ) )
#> <svg width="250" height="100"> #> <defs> #> <filter id="shadow" width="250" height="100"> #> <feDropShadow dx="1" dy="2" stdDeviation="1" flood-color="orange" flood-opacity="0.5"/> #> </filter> #> </defs> #> <text x="10" y="40" fill="#555555" font-size="2em" font-weight="bolder" filter="url(#shadow)">Shadowed</text> #> </svg>