Add a button for starting and stopping animations
m_button_animate(
id,
interval = 50,
loop = "backAndForth",
step = 1,
reps = 0,
label = "Play Animation",
stopButton = TRUE,
stopLabel = "Stop Animation"
)
R3dmol id
or a r3dmol
object (the output from
r3dmol()
).
Time in milliseconds between frames.
Direction of animation loop. 'backward'
, 'forward'
or 'backAndForth'
How many frames to step through. 1 plays every frame, 2 skips every second frame etc.
How many times to repeat the animation. 0 loops indefinitely.
String for button label.
Logical, whether to also create a button to stop the currently playing animation.
String for stop for stop animation button label.
R3dmol id
or a r3dmol
object (the output from
r3dmol()
)
xyz <- "4
* (null), Energy -1000.0000000
N 0.000005 0.019779 -0.000003 -0.157114 0.000052 -0.012746
H 0.931955 -0.364989 0.000003 1.507100 -0.601158 -0.004108
H -0.465975 -0.364992 0.807088 0.283368 0.257996 -0.583024
H -0.465979 -0.364991 -0.807088 0.392764 0.342436 0.764260
"
r3dmol(
backgroundColor = "0xeeeeee"
) %>%
m_add_model(
data = xyz,
format = "xyz",
options = list(vibrate = list(frames = 10, amplitude = 1))
) %>%
m_set_style(style = m_style_stick()) %>%
m_animate(list(loop = "backAndForth")) %>%
m_zoom_to() %>%
m_button_animate(step = 1, reps = 0, interval = 50)