Update an existing NGLVieweR stage in Shinymode.
updateStage(NGLVieweR_proxy, param = list())
A NGLVieweR object.
Of type list. Most common options are backgroundColor
,
rotateSpeed
, zoomSpeed
, hoverTimeout
and
lightIntensity
. For a full list of options, see the "StageParameters"
method in the official NGL.js manual.
API call containing NGLVieweR
id
and list of message
parameters.
NGLVieweR_example()
See example "updateStage".
Other updates:
updateColor()
,
updateRepresentation()
,
updateVisibility()
if (FALSE) { # \dontrun{
NGLVieweR("7CID") %>%
addRepresentation("cartoon",
param = list(name = "cartoon", color="red")) %>%
stageParameters(backgroundColor = "black")
} # }
if (interactive()) {
library(shiny)
ui = fluidPage(
titlePanel("Viewer with API inputs"),
sidebarLayout(
sidebarPanel(
selectInput("background", "Background", c("black", "white", "blue")),
actionButton("update", "Update"),
),
mainPanel(
NGLVieweROutput("structure")
)
)
)
server <- function(input, output) {
output$structure <- renderNGLVieweR({
NGLVieweR("7CID") %>%
addRepresentation("cartoon",
param = list(name = "cartoon", color = "red")
) %>%
stageParameters(backgroundColor = "black")
})
observeEvent(input$update, {
NGLVieweR_proxy("structure") %>%
updateStage(
param = list("backgroundColor" = isolate(input$background)))
})
}
shinyApp(ui, server)
}