JPlotSceneFn: Construct a plotting function from a list of scenes.

View source: R/anim-tools.R

JPlotSceneFnR Documentation

Construct a plotting function from a list of scenes.

Description

JPlotSceneFn is not usually called directly, rather it is invoked internally from inside JAnimateScenes. Combines a list of scenes, and returns a function that plots a single frame from the appropriate scene. Can be useful for debugging an animation, because it can be used to plot a single frame.

Usage

JPlotSceneFn(scenes)

Arguments

scenes

A list of scene objects, each one created by calling the JScene constructor.

Value

A function that accepts a single argument, a frame number, and plots the appropriate frame from the animation. The function is intended to be used as the plotFn argument to JAnimateGIF.

See Also

JAnimateScenes

Examples

# Construct an animation
scenes <- list(JScene(1, 20,
               pt2 = JTransition(0, 1),
               plotFn = function(pt2) {
                 plot(c(0, pt2), c(0, pt2), type = "b", xlim = c(0, 1))
               }))
# Plot frame 10 to see what it looks like
JPlotSceneFn(scenes)(10)


JimMcL/JUtils documentation built on Nov. 7, 2024, 11:25 a.m.