tween_along: Interpolate data along a given dimension

View source: R/tween_along.R

tween_alongR Documentation

Interpolate data along a given dimension

Description

This tween takes groups of rows along with the time for each row and calculates the exact value at each at each frame. Further it allows for keeping the subsequent raw data from previous frame as well as letting the final row linger beyond its time. It especially useful for data that should be visualised as lines that are drawn along the x-axis, but can of course also be used for other dimensions as well (even dimensions not corresponding to any axis).

Usage

tween_along(
  .data,
  ease,
  nframes,
  along,
  id = NULL,
  range = NULL,
  history = TRUE,
  keep_last = FALSE
)

Arguments

.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

along

The "time" point for each row

id

An unquoted expression giving the component id for each row. Will be evaluated in the context of .data so can refer to a column from that

range

The range of time points to include in the tween. If NULL it will use the range of time

history

Should earlier datapoints be kept in subsequent frames

keep_last

Should the last point of each id be kept beyond its time

Value

A data.frame with the same columns as .data along with .id giving the component id, .phase giving the state of each component in each frame, and .frame giving the frame membership of each row.

See Also

Other data.frame tween: tween_appear(), tween_components(), tween_elements(), tween_events(), tween_states()


tweenr documentation built on May 29, 2024, 6:32 a.m.