| anime_render | R Documentation |
Serialises an anime_timeline() or anime_animate() object to JSON and
wraps it together with an SVG payload in an htmlwidget.
anime_render(x, svg = NULL, width = NULL, height = NULL, elementId = NULL)
x |
An |
svg |
Character. Raw SVG markup to embed in the widget. If |
width |
Fixed width for widget (in css units). The default is
|
height |
Fixed height for widget (in css units). The default is
|
elementId |
Use an explicit element ID for the widget (rather than an automatically generated one). Useful if you have other JavaScript that needs to explicitly discover and interact with a specific widget instance. |
An object of class c("animejs", "htmlwidget").
tl <- anime_timeline(duration = 800) |>
anime_add(
selector = anime_target_class("dot"),
props = list(opacity = anime_from_to(0, 1))
)
svg <- '<svg viewBox="0 0 100 100"><circle class="dot" cx="50" cy="50" r="10"/></svg>'
if (interactive()) {
anime_render(tl, svg)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.