filter_offset: Filter: offset an element a specified amount

Description Usage Arguments Value Examples

View source: R/filters.R

Description

The offset filter applies an offset in the x and y directions to an existing element. The offset is handled by setting values for dx and dy.

Usage

1
filter_offset(dx = NULL, dy = NULL, what = "source")

Arguments

dx, dy

The offset of the element position compared to its initial position.

what

What exactly should be offset? By default, it is the "source" image.

Value

An svg object.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
if (interactive()) {

# Add a circle element to an
# SVG drawing and offset it
# by 10px to the right
SVG(width = 150, height = 150) %>%
  svg_filter(
    id = "offset_right",
    filters = list(
      filter_offset(dx = 50, dy = 0)
    )
  ) %>%
  svg_circle(
    x = 30, y = 30,
    diameter = 40,
    attrs = svg_attrs_pres(
      fill = "red",
      filter = "offset_right"
    )
  )
}

rich-iannone/omsvg documentation built on March 11, 2021, 5:13 p.m.