lottie_getProperty {shinyLottie} | R Documentation |
Get a Property of a 'Lottie' Animation
Description
Get a property from a specific 'Lottie' animation or all 'Lottie' animations.
Usage
lottie_getProperty(
property,
name = "all",
session = shiny::getDefaultReactiveDomain()
)
Arguments
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. |
Details
Sends a custom session message "lottie_js_getProperty"
containing the function arguments.
Value
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.
Examples
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)