gen_along: Generator for tweening along a variable

View source: R/gen_along.R

gen_alongR Documentation

Generator for tweening along a variable

Description

This is a generator version of tween_along(). It returns a generator that can be used with get_frame() and get_raw_frames() to extract frames for a specific time point scaled between 0 and 1.

Usage

gen_along(
  .data,
  ease,
  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.

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

An along_generator object

See Also

Other Other generators: gen_at(), gen_components(), gen_events(), gen_keyframe()

Examples

# Default behaviour
gen <- gen_along(airquality, ease = "linear", along = Day, id = Month)
get_frame(gen, 0.22)

# Overwrite keep_last or history in get_frame
get_frame(gen, 0.67, history = FALSE)

tweenr documentation built on Sept. 6, 2022, 9:05 a.m.