This question is already asked here but since there is no answer I thought I'd post another simple example in the hopes of finding an answer.
The problem is that the animation option for sliderInput() does not work when the slider is built dynamically using renderUI().
So while this works fine:
# works
library(shiny)
shinyApp(
ui = fluidPage(
sliderInput("animationSlider", "non-dynamic animation slider",
min = 1, max = 100, value = 1, step = 1,
animate = animationOptions(200)),
textOutput("sliderValue")
),
server = function(input, output) {
output$sliderValue <- renderText(paste("value:", input$animationSlider))
}
)
This doesn't work:
#doesn't work
library(shiny)
shinyApp(
ui = fluidPage(
numericInput("max", "Set max value for dynamic animation slider",
value = 10),
uiOutput("animationSlider"),
textOutput("sliderValue")
),
server = function(input, output) {
output$animationSlider <- renderUI({
sliderInput("animationSlider", "Dynamic animation slider",
min = 1, max = input$max, value = 1, step = 1,
animate = animationOptions(200))
})
output$sliderValue <- renderText(paste("value:", input$animationSlider))
}
)