lottie_playback_controls {shinyLottie} | R Documentation |
Control Playback of 'Lottie' Animations
Description
Control the playback of 'Lottie' animations within a 'shiny' application.
Usage
lottie_play(name = "all", session = shiny::getDefaultReactiveDomain())
lottie_pause(name = "all", session = shiny::getDefaultReactiveDomain())
lottie_stop(name = "all", session = shiny::getDefaultReactiveDomain())
Arguments
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. |
Details
Each function sends a corresponding custom session message containing the function arguments:
Play: "
lottie_js_play
"Pause: "
lottie_js_pause
"Stop: "
lottie_js_stop
"
Value
These functions are 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("play", "Play Animation"),
actionButton("pause", "Pause Animation"),
actionButton("stop", "Stop Animation")
)
server <- function(input, output, session) {
observeEvent(input$play, {
lottie_play(name = "my_animation")
})
observeEvent(input$pause, {
lottie_pause(name = "my_animation")
})
observeEvent(input$stop, {
lottie_stop(name = "my_animation")
})
}
shinyApp(ui, server)
[Package shinyLottie version 1.0.0 Index]