Styling options for the various shapes. Used inside m_add_sphere(), m_add_arrow(), m_add_cylinder() etc.

m_shape_spec(
  color = NULL,
  opacity = 1,
  wireframe = FALSE,
  hidden = FALSE,
  frame = NULL,
  clickable = FALSE,
  callback = NULL,
  hoverable = FALSE,
  hover_callback = NULL,
  unhover_callback = NULL
)

Arguments

color

Solid color values.

opacity

Transparency value. 1 for opaque, 0 for invisible.

wireframe

Draw as wireframe, not solid surface.

hidden

If true, do not display object.

frame

If set, only display in this frame of an animation.

clickable

If true, user can click on object to trigger callback.

callback

Function to call on click.

hoverable

Logical, enabling hover_callback and unhover_callback functions to be called. Set hoverDuration in the viewer_spec() of r3dmol().

hover_callback

Function to be called upon hover.

unhover_callback

Function to be called upon hover stopping.

Examples

library(r3dmol)
if (FALSE) {
r3dmol() %>%
  m_add_model(data = m_fetch_pdb("1bna")) %>%
  m_add_sphere(
    center = m_sel(resi = 1),
    spec = m_shape_spec(color = "green", wireframe = TRUE)
  ) %>%
  m_zoom_to(sel = m_sel(resi = 1))
}