Navigate to a Specific Animation Frame
lottie_navigate_frame.Rd
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
value
is a frame number (TRUE
) or time (FALSE
).- 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.
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.
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("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)
}