m_translate: Translate current view or models by x,y screen coordinates

Description Usage Arguments Value Examples

View source: R/animation.R

Description

m_translate() pans the camera rather than translating the model. m_translate_scene() translates the models relative to the current view. It does not change the center of rotation.

Usage

1
2
3
m_translate(id, x, y, animationDuration, fixedPath)

m_translate_scene(id, x, y, animationDuration, fixedPath)

Arguments

id

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

x

Relative change numeric in view coordinates of camera

y

Relative change numeric in view coordinates of camera

animationDuration

an optional parameter of milliseconds numeric that denotes the duration of a zoom animation

fixedPath

if true animation is constrained to requested motion, overriding updates that happen during the animation

Value

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

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
library(r3dmol)

# Translate current view by x,y screen coordinates
r3dmol() %>%
  m_add_model(data = pdb_1j72, format = "pdb") %>%
  m_set_style(style = c(m_style_cartoon(), m_style_stick())) %>%
  m_translate(
    x = 200,
    y = 50,
    animationDuration = 1000
  ) %>%
  m_rotate(
    angle = 90,
    axis = "z",
    animationDuration = 1000
  ) %>%
  m_zoom_to()

# Translate current models by x,y screen coordinates
r3dmol() %>%
  m_add_model(data = pdb_1j72, format = "pdb") %>%
  m_set_style(style = c(m_style_cartoon(), m_style_stick())) %>%
  m_translate_scene(
    x = 200,
    y = 50,
    animationDuration = 1000
  ) %>%
  m_rotate(
    angle = 90,
    axis = "z",
    animationDuration = 1000
  ) %>%
  m_zoom_to()

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