r - Shiny Changing Slider Animation Speed -


i wondering if there way change animation speed of slider in shiny. so, slider (in ui.r) :

sliderinput("test_slider",              "animation:",               min = 1,               max = 200,               value = 100,               animate = animationoptions(interval = animation speed)) 

i want able change animation speed rather keeping @ static value set in beginning. also, animation works when put in ui, can't make reactive ui in server. example, can't in server.r

output$test_slider <- renderui({    sliderinput("test_slider",                 "animation:",                  min = 1,                  max = 200,                  value = 100,                  animate = animationoptions(interval = animation speed)) }) 

and add in ui.r

uioutput("test_slider") 

this have been ideal since customize things min , max (and animation speed), unfortunately doing way makes play button doesn't work , animation doesn't start. @ loss how dynamically change slider input parameters. if solution involves javascript, totally fine that. thank much.


edit:

so don't have answer yet, i've gotten closer. looked through javascript file , added (in ui.r):

         numericinput("anim",                       "interval: ",                       value = 100),          sliderinput("test_slider",                     "animation",                      min = 1,                      max = 200,                      value = 100,                      step = 1,                      animate = animationoptions(interval = 700,                                playbutton = icon('play', "fa-3x"),                                pausebutton = icon('pause', "fa-3x"))),         singleton(           tags$head(tags$script('shiny.addcustommessagehandler("testmessage",                 function(message) {$(this).attr("data-interval", message.interval);                                  console.log($(this).attr("data-interval"))});'))           ) 

i have console.log show sending right thing since printing correct value in terminal. in server.r:

  observe({     if(!is.null(input$anim)) {       session$sendcustommessage(type = "testmessage",                                  message = list(interval = input$anim,                                          controller = input$test_slider))     }   }) 

i using both documentation in shiny repo here: https://github.com/rstudio/shiny/blob/a6cd0fdb85d5d2175ebc4fcb590386e4cedcbbd9/srcjs/input_binding_slider.js

as documentation found on blog here: https://ryouready.wordpress.com/2013/11/20/sending-data-from-client-to-server-and-back-using-shiny/

the 1 github repo i'm using part below says

animinterval = self.attr("data-interval") 

where

 var self = $(this) 

i've never used javascript before, missing obvious. appreciated!

i'm not sure if understand issue if following work :

in server.r :

output$slider_to_anim <- renderui({   sliderinput("slider",             "animation:",              min = 1,              max = 200,              value = 100,              animate = animationoptions(interval = input$speed)) })  output$speed_value <- renderui({   numericinput("speed","speed value :",value = 100) }) 

and add in ui.r :

uioutpout("slider_to_anim"), uioutpout("speed_value") 

Comments

Popular posts from this blog

javascript - Google App Script ContentService downloadAsFile not working -

javascript - Function overwritting -

php - Find a regex to take part of Email -