lottie_setSpeed {shinyLottie}R Documentation

Adjust 'Lottie' Animation Speed

Description

Adjust the speed of an existing 'Lottie' animation.

Usage

lottie_setSpeed(
  speed = 1,
  name = "all",
  session = shiny::getDefaultReactiveDomain()
)

Arguments

speed

A numeric specifying the desired animation speed.

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

Sends a custom session message "lottie_js_setSpeed" containing the function arguments.

Value

This function is called for a side effect, and so there is no return value.

Note

A speed of 1 will apply the default animation speed. Use a value between 0 and 1 for a slower animation speed. Applying a negative speed will also reverse the playback direction.

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"
  ),
  numericInput("speed", "Speed", value = 1),
  actionButton("updateSpeed", "Update Speed")
)

server <- function(input, output, session) {
  observeEvent(input$updateSpeed, {
    lottie_setSpeed(speed = input$speed, name = "my_animation")
  })
}

shinyApp(ui, server)


[Package shinyLottie version 1.0.0 Index]