as_svg_anim {emphatic}R Documentation

Wrap multiple emphatic object into an SVG animation

Description

Idea borrowed from pointblank

Usage

as_svg_anim(
  x,
  width = 1200,
  height = 900,
  duration = 1,
  playback = c("infinite", "click"),
  font_size = NULL,
  style = list(),
  svg_id = NULL,
  browsable = FALSE
)

Arguments

x

list of emphatic objects

width, height

viewBox dimensions for SVG

duration

frame duration in seconds. May be a single value used for all frames, or a vector of values (one duration value for each frame). Can be fractions of a second.

playback

'click', 'infinite'

font_size

CSS font-size. Default: NULL means to not adjust font size. Otherwise, use valid CSS font-size specification e.g. "3em", "22px" etc.

style

html tag styling to apply to the <pre> wrapper for the returned HTML

svg_id

ID to use for the SVG tag. Default: NULL means to create a random ID

browsable

Should the SVG be rendered to the RStudio Viewer pane when when printed (instead of console output)? Default: FALSE

Value

Character string containing an animated SVG representation displaying all elements sequentially

Examples

list(
  hl_diff('hello', 'there'),
  hl_diff('goodbye', 'good boy')
) |>
  as_svg_anim() |>
  cat()

[Package emphatic version 0.1.8 Index]