Continuously rotate a scene around the specified axis

m_spin(id, axis = "y", speed = 1)

Arguments

id

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

axis

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

speed

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

Value

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

Examples

library(r3dmol)
model <- r3dmol() %>%
  m_add_model(data = pdb_6zsl, format = "pdb") %>%
  m_set_style(style = m_style_cartoon(color = "spectrum")) %>%
  m_zoom_to()

# spin the model
model %>% m_spin()
# reverses the direction of spin model %>% m_spin(speed = -0.5)