tween_states: Tween a list of data.frames representing states

Description Usage Arguments Value See Also Examples

Description

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.

Usage

1
tween_states(data, tweenlength, statelength, ease, nframes)

Arguments

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 tweenlength and statelength.

Value

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.

See Also

Other data.frame tween: tween_along, tween_appear, tween_components, tween_elements, tween_events

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
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)

thomasp85/tweenr documentation built on May 31, 2019, 11:16 a.m.