View source: R/lottie_setSubframe.R
lottie_setSubframe | R Documentation |
Adjust the subframe rendering of a 'Lottie' animation.
lottie_setSubframe(
flag,
name = "all",
session = shiny::getDefaultReactiveDomain()
)
flag |
A logical value specifying whether a 'Lottie' animation should use subframe rendering ( |
name |
A character string specifying the name of the 'Lottie' animation to control.
The default of " |
session |
The 'shiny' session object. Defaults to the current reactive domain. |
Sends a custom session message "lottie_js_setSubframe"
containing the function arguments.
This function is called for a side effect, and so there is no return value.
lottie_animation_methods
for similar methods.
library(shiny)
library(shinyLottie)
ui <- fluidPage(
include_lottie(),
lottie_animation(
path = "shinyLottie/example.json",
name = "my_animation"
),
actionButton("subframeOn", "Subframe On"),
actionButton("subframeOff", "Subframe Off")
)
server <- function(input, output, session) {
observeEvent(input$subframeOn, {
lottie_setSubframe(flag = TRUE, name = "my_animation")
})
observeEvent(input$subframeOff, {
lottie_setSubframe(flag = FALSE, name = "my_animation")
})
}
shinyApp(ui, server)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.