View source: R/tween_elements.R
tween_elements | R Documentation |
This function creates tweens for each observation individually, in cases where the data doesn't pass through collective states but consists of fully independent transitions. Each observation is identified by an id and each state must have a time associated with it.
tween_elements(data, time, group, ease, timerange, nframes)
data |
A data.frame consisting at least of a column giving the observation id, a column giving timepoints for each state and a column giving the easing to apply when transitioning away from the state. |
time |
The name of the column holding timepoints |
group |
The name of the column holding the observation id |
ease |
The name of the column holding the easing function name |
timerange |
The range of time to span. If missing it will default to
|
nframes |
The number of frames to generate. If missing it will default
to |
A data.frame with the same columns as data
except for the
group and ease columns, but replicated nframes
times. Two additional
columns called .frame
and .group
will be added giving the frame
number and observation id for each row.
Other data.frame tween:
tween_along()
,
tween_appear()
,
tween_components()
,
tween_events()
,
tween_states()
data <- data.frame(
x = c(1, 2, 2, 1, 2, 2),
y = c(1, 2, 2, 2, 1, 1),
time = c(1, 4, 10, 4, 8, 10),
group = c(1, 1, 1, 2, 2, 2),
ease = rep('cubic-in-out', 6)
)
data <- tween_elements(data, 'time', 'group', 'ease', nframes = 100)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.