View source: R/gen_components.R
gen_components | R Documentation |
This is a generator versions of tween_components()
. It returns a generator
that can be used with get_frame()
and get_raw_frames()
to extract frames
for a specific time point scaled between 0 and 1.
gen_components(
.data,
ease,
nframes,
time,
id = NULL,
range = NULL,
enter = NULL,
exit = NULL,
enter_length = 0,
exit_length = 0
)
.data |
A data.frame with components at different stages |
ease |
The easing function to use. Either a single string or one for each column in the data set. |
nframes |
The number of frames to calculate for the tween |
time |
An unquoted expression giving the timepoint for the different
stages of the components. Will be evaluated in the context of |
id |
An unquoted expression giving the component id for each row. Will
be evaluated in the context of |
range |
The range of time points to include in the tween. If |
enter , exit |
functions that calculate a start state for new observations
that appear in |
enter_length , exit_length |
The lenght of the opening and closing
transitions if |
A component_generator
object
Other Other generators:
gen_along()
,
gen_at()
,
gen_events()
,
gen_keyframe()
from_zero <- function(x) {x$x <- 0; x}
data <- data.frame(
x = c(1, 2, 2, 1, 2, 2),
y = c(1, 2, 2, 2, 1, 1),
time = c(1, 4, 8, 4, 8, 10),
id = c(1, 1, 1, 2, 2, 2)
)
gen <- gen_components(data, 'cubic-in-out', time = time, id = id,
enter = from_zero, enter_length = 4)
get_frame(gen, 0.3)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.