lottie_callMethod {shinyLottie} | R Documentation |
Call a 'Lottie' Method
Description
Call a method for a specific 'Lottie' animation or all 'Lottie' animations.
Usage
lottie_callMethod(
name = "all",
method,
argument = "",
session = shiny::getDefaultReactiveDomain()
)
Arguments
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. |
Details
Sends a custom session message "lottie_js_callMethod"
containing the function arguments.
Value
This function is called for a side effect, and so there is no return value.
Examples
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)
[Package shinyLottie version 1.0.0 Index]