View source: R/plt-double-pendulum.R
| animate_double_pendulum | R Documentation |
Animate a Double Pendulum
animate_double_pendulum(.data, .walk = 1, .trail_length = 30)
.data |
Data returned by |
.walk |
One walk_number label to display, rather than its position. |
.trail_length |
Nonnegative integer number of recent sampled positions in the second bob's trail, including the current position. Zero disables it. |
Requires optional packages ggplot2 and gganimate. GIF rendering
additionally requires gifski. Each observation is one discrete frame;
rendering at fps = 1 / .delta_time preserves simulated time.
A gganim object. Construction does not render or save files.
Steven P. Sanderson II, MPH
Other Visualization Functions:
plot_double_pendulum(),
visualize_walks()
## Not run:
walks <- double_pendulum_walk(.num_walks = 1, .n = 200)
animation <- animate_double_pendulum(walks)
gif <- gganimate::animate(animation, nframes = attr(walks, "n"),
fps = 1 / attr(walks, "delta_time"), renderer = gganimate::gifski_renderer())
gganimate::anim_save("double-pendulum.gif", animation = gif)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.