lottie_navigate_frame {shinyLottie} | R Documentation |
Navigate to a Specific Animation Frame
Description
Navigate to a specific frame or time and either stop or play the animation.
Usage
lottie_goToAndStop(
value,
isFrame = TRUE,
name = "all",
session = shiny::getDefaultReactiveDomain()
)
lottie_goToAndPlay(
value,
isFrame = TRUE,
name = "all",
session = shiny::getDefaultReactiveDomain()
)
Arguments
value |
A numeric value specifying the frame or time to go to. |
isFrame |
A logical value indicating whether |
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
lottie_goToAndStop
moves the animation to a specific frame or time, then stops it.
Sends a custom session message "lottie_js_goToAndStop"
containing the function arguments.
lottie_goToAndPlay
moves the animation to a specific frame or time, then continues playback.
Sends a custom session message "lottie_js_goToAndPlay"
containing the function arguments.
Value
These functions are called for a side effect, and so there is no return value.
See Also
lottie_animation_methods
for similar methods.
Examples
library(shiny)
library(shinyLottie)
ui <- fluidPage(
include_lottie(),
lottie_animation(
path = "shinyLottie/example.json",
name = "my_animation"
),
actionButton("goToAndStop", "Go To Frame 10 And Stop"),
actionButton("goToAndPlay", "Go To Frame 10 And Play")
)
server <- function(input, output, session) {
observeEvent(input$goToAndStop, {
lottie_goToAndStop(value = 10, isFrame = TRUE, name = "my_animation")
})
observeEvent(input$goToAndPlay, {
lottie_goToAndPlay(value = 10, isFrame = TRUE, name = "my_animation")
})
}
shinyApp(ui, server)