Description Usage Arguments Value See Also Examples
Update the focus of an existing NGLVieweR object in Shinymode.
1 | updateFocus(NGLVieweR_proxy, focus = 0)
|
NGLVieweR_proxy |
A NGLVieweR object. |
focus |
Numeric value between 0-100 (default = 0). |
API call containing NGLVieweR
id
and list of message parameters.
setFocus()
NGLVieweR_example()
See example "updateFocus".
Other options:
setFocus()
,
setQuality()
,
snapShot()
,
updateFullscreen()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | ## Not run:
NGLVieweR_proxy("structure") %>%
updateFocus(focus = 50)
## End(Not run)
if (interactive()) {
library(shiny)
ui = fluidPage(
titlePanel("Viewer with API inputs"),
sidebarLayout(
sidebarPanel(
sliderInput("focus", "Focus", 0, 100, 50)
),
mainPanel(
NGLVieweROutput("structure")
)
)
)
server = function(input, output) {
output$structure <- renderNGLVieweR({
NGLVieweR("7CID") %>%
addRepresentation("cartoon",
param = list(name = "cartoon", color= "red"))
})
observeEvent(input$focus, {
NGLVieweR_proxy("structure") %>%
updateFocus(input$focus)
})
}
shinyApp(ui, server)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.