View source: R/lottie_callMethod.R
lottie_callMethod | R Documentation |
Call a method for a specific 'Lottie' animation or all 'Lottie' animations.
lottie_callMethod(
name = "all",
method,
argument = "",
session = shiny::getDefaultReactiveDomain()
)
name |
A character string specifying the name of the 'Lottie' animation to query.
The default of " |
method |
A character string specifying the name of the method to call. |
argument |
A character string specifying any optional arguments to pass to the method. |
session |
The 'shiny' session object. Defaults to the current reactive domain. |
Sends a custom session message "lottie_js_callMethod"
containing the function arguments.
This function is called for a side effect, and so there is no return value.
library(shiny)
library(shinyLottie)
ui <- fluidPage(
include_lottie(),
lottie_animation(
path = "shinyLottie/example.json",
name = "my_animation"
),
actionButton("callMethod", "Call Method (Reverse Direction)")
)
server <- function(input, output, session) {
observeEvent(input$callMethod, {
lottie_callMethod(name = "my_animation", method = "setDirection", argument = "-1")
})
}
shinyApp(ui, server)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.