Skip to contents

Builds an animated GIF of a short 16mm instructional clip with gate weave, flicker, and per-frame dust. Each frame calls patina_edu_film() with per-frame jitter and seed, then adds slight brightness flicker and tiny XY weave. Dimensions are preserved.

Usage

animate_edu_film(
  img,
  n_frames = 48,
  fps = 10,
  weave_deg = 0.1,
  jitter_xy = 0.1,
  flicker = 0.06,
  loop = 0,
  bg = "black",
  seed = NULL,
  write_gif = NULL,
  max_dust = 0.3,
  ...
)

Arguments

img

magick image (your rasterized ggplot)

n_frames

number of frames (e.g., 48)

fps

frames per second (e.g., 10)

weave_deg

max rotation (deg) for gate weave (per-frame)

jitter_xy

max XY translation in pixels (per-frame)

flicker

amplitude of brightness flicker (0..0.2 ~ gentle)

loop

0 = loop forever (GIF), otherwise number of loops

bg

background color used when translating/rotating (usually "black")

seed

optional integer; if set, dust/scratches vary per-frame deterministically

write_gif

optional file path; if provided, writes the GIF and also returns it

max_dust

if not using a fixed dust in ..., generate random dust form 0...max_dust

...

passed to patina_edu_film() (e.g., warmth, grain, dust_polarity, dust_n, scratches)

Value

an animated magick-image (GIF). If write_gif is provided, the file is also written.

Examples

if (FALSE) { # \dontrun{
if (requireNamespace("magick", quietly = TRUE)) {
  img <- magick::image_blank(100, 100, "white")
  animate_edu_film(img, n_frames = 5, fps = 2)
}
} # }