Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

sceneChange

Make large change to a scene from Shiny


Description

These functions allow Shiny apps to make relatively large changes to a scene, adding and removing objects from it.

Usage

sceneChange(elementId, x = scene3d(minimal),
            delete = NULL, add = NULL, replace = NULL,
            material = FALSE, rootSubscene = FALSE,
            delfromSubscenes = NULL, skipRedraw = FALSE,
            minimal = TRUE)
registerSceneChange()

Arguments

elementId

The id of the element holding the rglClass instance.

x

The new scene to use as a source for objects to add.

delete, add, replace

Object ids to modify in the scene. The delete and replace ids must be present in the old scene in the browser; the add and replace ids must be present in x.

material

Logical to indicate whether default material should be updated.

rootSubscene

Logical to indicate whether root subscene should be updated.

delfromSubscenes

A vector of subscene ids that may have been changed by deletions. By default, all subscenes in x are used, but the objects may be included in subscenes in the browser that are different.

skipRedraw

If TRUE, stop the scene from redrawing until skipRedraw=FALSE is sent. If NA, don't redraw this time, but don't change the state of the skipRedraw flag.

minimal

See scene3d.

Details

registerSceneChange must be called in the UI component of a Shiny app to register the "sceneChange" custom message.

Value

registerSceneChange returns the HTML code to register the message.

sceneChange returns a list to be used as the "sceneChange" message to change the scene. Use shiny::session$sendCustomMessage to send it.

Author(s)

Duncan Murdoch

See Also

playwidget for a different approach to modifying scenes that can be much faster, but may be less flexible. The Shiny demo in this package makes use of all of these approaches.

Examples

## Not run: 
shinyUI(fluidPage(
  registerSceneChange(),
  actionButton("thebutton", "Change")
))

shinyServer(function(input, output, session) {
  observeEvent(input$thebutton, {
    session$sendCustomMessage("sceneChange",
      sceneChange("thewidget", delete = deletes, add = adds))
  })
})

## End(Not run)

rgl

3D Visualization Using OpenGL

v0.106.8
GPL
Authors
Duncan Murdoch [aut, cre], Daniel Adler [aut], Oleg Nenadic [ctb], Simon Urbanek [ctb], Ming Chen [ctb], Albrecht Gebhardt [ctb], Ben Bolker [ctb], Gabor Csardi [ctb], Adam Strzelecki [ctb], Alexander Senger [ctb], The R Core Team [ctb, cph], Dirk Eddelbuettel [ctb], The authors of Shiny [cph], The authors of knitr [cph], Jeroen Ooms [ctb], Yohann Demont [ctb], Joshua Ulrich [ctb], Xavier Fernandez i Marin [ctb], George Helffrich [ctb], Ivan Krylov [ctb]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.