Adjust 'Lottie' Animation Direction
lottie_setDirection.Rd
Adjust the playback direction of an existing 'Lottie' animation.
Usage
lottie_setDirection(
direction = 1,
name = "all",
session = shiny::getDefaultReactiveDomain()
)
Arguments
- direction
Either
1
for forward playback or-1
for reverse playback.- name
A character string specifying the name of the 'Lottie' animation to control. The default of "
all
" will control all animations within the 'shiny' application.- session
The 'shiny' session object. Defaults to the current reactive domain.
See also
lottie_animation_methods
for similar methods.
Examples
if (FALSE) { # interactive()
library(shiny)
library(shinyLottie)
ui <- fluidPage(
include_lottie(),
lottie_animation(
path = "shinyLottie/example.json",
name = "my_animation"
),
actionButton("forwards", "Play Forwards"),
actionButton("backwards", "Play Backwards")
)
server <- function(input, output, session) {
observeEvent(input$forwards, {
lottie_setDirection(direction = 1, name = "my_animation")
})
observeEvent(input$backwards, {
lottie_setDirection(direction = -1, name = "my_animation")
})
}
shinyApp(ui, server)
}