tween_states | R Documentation |
This function is intended to create smooth transitions between states of data. States are defined as full data.frames or data.frames containing only the columns with change. Each state can have a defined period of pause, the transition length between each states can be defined as well as the easing function.
tween_states(data, tweenlength, statelength, ease, nframes)
data |
A list of data.frames. Each data.frame must contain the same number of rows, but only the first data.frame needs to contain all columns. Subsequent data.frames need only contain the columns that shows change. |
tweenlength |
The lengths of the transitions between each state. |
statelength |
The length of the pause at each state. |
ease |
The easing functions to use for the transitions. See details. |
nframes |
The number of frames to generate. The actual number of frames
might end up being higher depending on the regularity of |
A data.frame with the same columns as the first data.frame in
data
, but replicated nframes
times. An additional column called
.frame
will be added giving the frame number.
Other data.frame tween:
tween_along()
,
tween_appear()
,
tween_components()
,
tween_elements()
,
tween_events()
data1 <- data.frame(
x = 1:20,
y = 0,
colour = 'forestgreen',
stringsAsFactors = FALSE
)
data2 <- data1
data2$x <- 20:1
data2$y <- 1
data <- tween_states(list(data1, data2), 3, 1, 'cubic-in-out', 100)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.