Unlimited learning, half price | 50% off

Last chance! 50% off unlimited learning

Sale ends in


tweenr (version 2.0.3)

gen_along: 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
)

Value

An along_generator object

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

See Also

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

Examples

Run this code
# 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)

Run the code above in your browser using DataLab