View source: R/lottie_getProperty.R
lottie_getProperty | R Documentation |
Get a property from a specific 'Lottie' animation or all 'Lottie' animations.
lottie_getProperty(
property,
name = "all",
session = shiny::getDefaultReactiveDomain()
)
property |
A character string specifying the name of the property to retrieve. |
name |
A character string specifying the name of the 'Lottie' animation to query.
The default of " |
session |
The 'shiny' session object. Defaults to the current reactive domain. |
Sends a custom session message "lottie_js_getProperty"
containing the function arguments.
The return value(s) can be retrieved from within a reactive context by accessing the input
object of the 'shiny' session, where the value has been assigned as the property name. For example, if accessing the
playCount
property, the return value can be retrieved via input$playCount
.
If name = "all"
has been specified, then the return object will be a list, with named elements
corresponding to the animation names.
library(shiny)
library(shinyLottie)
ui <- fluidPage(
include_lottie(),
lottie_animation(
path = "shinyLottie/example.json",
name = "my_animation"
),
actionButton("getProperty", "Update Play Count"),
textOutput("playCountOutput")
)
server <- function(input, output, session) {
observeEvent(input$getProperty, {
lottie_getProperty(name = "my_animation", property = "playCount")
})
observe({
req(input$playCount)
output$playCountOutput <- renderText({
paste("Play Count:", input$playCount)
})
})
}
shinyApp(ui, server)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.