animate_double_pendulum: Animate a Double Pendulum

View source: R/plt-double-pendulum.R

animate_double_pendulumR Documentation

Animate a Double Pendulum

Description

Animate a Double Pendulum

Usage

animate_double_pendulum(.data, .walk = 1, .trail_length = 30)

Arguments

.data

Data returned by double_pendulum_walk().

.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.

Details

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.

Value

A gganim object. Construction does not render or save files.

Author(s)

Steven P. Sanderson II, MPH

See Also

Other Visualization Functions: plot_double_pendulum(), visualize_walks()

Examples

## 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)

RandomWalker documentation built on Sept. 8, 2026, 1:06 a.m.