m_spin: Continuously rotate a scene around the specified axis

Description Usage Arguments Value Examples

View source: R/animation.R

Description

Continuously rotate a scene around the specified axis

Usage

1
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
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)

r3dmol documentation built on March 14, 2021, 5:08 p.m.