Skip to contents

Responsible for retrieving the 'Lottie' library and initialising the necessary 'JavaScript' library. As such, this function must be included within the UI object of a shinyApp in order to enable 'shinyLottie' functionality.

Usage

include_lottie(version = "5.12.2")

Arguments

version

A character string specifying the version of the 'Lottie' library to source via CDN.

Value

A list of HTML tags to be included within the head element of a 'shiny' application.

Note

Calling this function initialises a global object "window.lottieInstances" once the DOM content is fully loaded. This is used to store the 'Lottie' animations that are created using lottie_animation.

Examples

if (FALSE) { # interactive()
library(shiny)
library(shinyLottie)

ui <- fluidPage(
  include_lottie(),
  lottie_animation(
    path = "shinyLottie/example.json",
    name = "my_animation"
  )
)

server <- function(input, output, session) {}

shinyApp(ui, server)
}