tween_elements

0th

Percentile

Create frames based on individual element states

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.

Usage
tween_elements(data, time, group, ease, timerange, nframes)
Arguments
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 range(data[[time]])

nframes

The number of frames to generate. If missing it will default to ceiling(diff(timerange) + 1) (At least one frame for each individual timepoint)

Value

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.

See Also

Other data.frame.tween: tween_appear, tween_states

Aliases
  • tween_elements
Examples
# NOT RUN {
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)

# }
Documentation reproduced from package tweenr, version 0.1.5, License: GPL (>= 2)

Community examples

Looks like there are no examples yet.