vl_render_frame() draws the single frame that vl_render_animation()
would draw for one schedule entry – keyframe pair seg at fraction frac
– and writes it as a still image: a poster for an animation, a thumbnail,
or the frame to put in print. The marks are matched and tweened exactly as
in the animation (see Matching marks by identity in
vl_render_animation()), and a per-frame text variant is swapped in the
same way.
Usage
vl_render_frame(
keyframes,
seg,
frac,
path,
frac_col = frac,
frac_size = frac,
frac_alpha = frac,
text_variant = NULL,
text = c("native", "outline"),
scale = 1
)Arguments
- keyframes
A list of at least two scenes (each a
vl_scene()or anything with anas_vellum_scene()method), all the same pixel size.- seg
The 1-based index of the left keyframe of the pair (a single integer in
1:(length(keyframes) - 1)).- frac
The positional fraction between keyframe
segandseg + 1(a single number;0is keyframeseg,1is keyframeseg + 1).- path
Output file path; the format is taken from the extension (
.png,.svgor.pdf), as forrender().- frac_col, frac_size, frac_alpha
The fractions of the other property classes; default
frac.- text_variant
A scene whose keyed text replaces the frame's text with the same keys (one entry of
text_variantsinvl_render_animation()), orNULL.- text
For SVG output, how text is written:
"native"(default) emits selectable<text>referencing system fonts,"outline"emits glyph outlines (pixel-faithful, identical to the raster/PDF backends, but not selectable). Ignored for PNG/PDF.- scale
Resolution multiplier (default
1).scale = 2renders at twice the device pixels while keeping the same physical size — the retina /ggsave(scaling=)idiom. It multipliesdpi, so absolute units (mm,pt,in) cover proportionally more pixels and nothing about the layout changes; text does not get relatively bigger or smaller. Only raster output gains anything: a PDF's page size in points and an SVG's physical size are unchanged by construction.
Examples
a <- vl_scene(2, 2) |> draw(circle_grob(r = 0.1, gp = vl_gpar(fill = "tomato")))
b <- vl_scene(2, 2) |> draw(circle_grob(r = 0.4, gp = vl_gpar(fill = "tomato")))
vl_render_frame(list(a, b), 1, 0.5, tempfile(fileext = ".png"))
