if (FALSE) { # interactive()
library(shiny)
library(shinyLottie)
ui <- fluidPage(
include_lottie(),
# Create an 'animation' event listener that prints a message to the
# browser console after each loop
lottie_animation(
path = "shinyLottie/example.json",
name = "my_animation"
) |>
lottie_addEventListener(
event = "loopComplete",
target = "animation",
custom_js = "console.log('Animation Complete!');"
),
# Create a 'container' event listener that plays an animation when
# hovering over the button, and another that pauses the animation
# when hovering stops
lottie_animation(
path = "shinyLottie/example.json",
name = "button",
width = "200px",
height = "100px",
loop = TRUE,
autoplay = FALSE,
) |> lottie_button(inputId = "lottieButton", label = "Lottie",
height = "200px", width = "200px") |>
lottie_addEventListener("mouseenter", "container", state = "play") |>
lottie_addEventListener("mouseleave", "container", state = "pause")
)
server <- function(input, output, session) {}
shinyApp(ui, server)
}
Run the code above in your browser using DataLab