Add a button for spinning the scene

m_button_spin(
  id,
  speed = 1,
  axis = "y",
  label = "Spin",
  stopButton = TRUE,
  stopLabel = "Stop"
)

Arguments

id

R3dmol id or a r3dmol object (the output from r3dmol()).

speed

Speed multiplier for spin animation. Defaults to 1. Negative value reverses the direction of spin.

axis

Axis ("x", "y", "z", "vx", "vy", "vz") to rotate around. Default "y". View relative (rather than model relative) axes are prefixed with "v".

label

String for button label.

stopButton

Logical, whether to also create a button to stop the spin.

stopLabel

String for the stop button label.

Value

R3dmol id or a r3dmol object (the output from r3dmol())

Examples

# Add buttons to start and stop spin
r3dmol() %>%
  m_add_model(data = pdb_1j72, format = "pdb") %>%
  m_zoom_to() %>%
  m_set_style(m_style_cartoon()) %>%
  m_button_spin()
# Add buttons to stop already spinning scene r3dmol() %>% m_add_model(data = pdb_1j72, format = "pdb") %>% m_zoom_to() %>% m_set_style(m_style_cartoon()) %>% m_spin() %>% m_button_spin()