I am trying to use the shinyanimate package to continuously animate an image element in my shiny app.
I tried to use a while loop to check if the session was open, but I'm not sure why this approach is not working.
library(shiny)
library(shinyanimate)
ui <- fluidPage(
withAnim(),
div(id = "blood",
tags$img(src = "https://inews-prd-a-images.s3.eu-west-2.amazonaws.com/content/uploads/2019/02/Blood-droplet-640x360.jpg",
width = "100px",
height = "100px")),
# Application title
titlePanel("Test app")
)
server <- function(input, output, session) {
while (session$isClosed() == FALSE){
observe(startAnim(session, "blood", "pulse"))
}
}
shinyApp(ui = ui, server = server)