View source: R/lottie_animation.R
lottie_animation | R Documentation |
Generates a 'Lottie' animation for use within a 'shiny' application.
lottie_animation(
path,
name,
loop = TRUE,
autoplay = TRUE,
renderer = "svg",
width = "400px",
height = "400px",
...,
session = shiny::getDefaultReactiveDomain()
)
path |
Either a URL or local file path (see Note). |
name |
A character string specifying the name to give to the animation. |
loop |
Logical indicating whether the animation should loop. |
autoplay |
Logical indicating whether the animation should autoplay. |
renderer |
The renderer to use for the animation, either |
width |
The width of the animation container. This is validated using |
height |
The height of the animation container. This is validated using |
... |
Additional animation options, including:
|
session |
The 'shiny' session object. Defaults to the current reactive domain. |
A list containing the following elements:
div
An HTML div
element serving as the 'Lottie' animation container.
script
A script
tag containing the 'JavaScript' to initialise the 'Lottie' animation.
When using a local file path, you may need to use addResourcePath
.
library(shiny)
library(shinyLottie)
ui <- fluidPage(
include_lottie(),
lottie_animation(
path = "shinyLottie/example.json",
name = "my_animation"
)
)
server <- function(input, output, session) {}
shinyApp(ui, server)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.