gen_at: Generator for interpolating between two data frames

View source: R/gen_at.R

gen_atR Documentation

Generator for interpolating between two data frames

Description

This is a generator version of tween_at() with the additional functionality of supporting enter and exit functions. 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_at(from, to, ease, id = NULL, enter = NULL, exit = NULL)

Arguments

from, to

A data.frame or vector of the same type. If either is of length/nrow 1 it will get repeated to match the length of the other

ease

A character vector giving valid easing functions. Recycled to match the ncol of from

id

The column to match observations on. If NULL observations will be matched by position. See the Match, Enter, and Exit section for more information.

enter, exit

functions that calculate a start state for new observations that appear in to or an end state for observations that are not present in to. If NULL the new/old observations will not be part of the tween. The function gets a data.frame with either the start state of the exiting observations, or the end state of the entering observations and must return a modified version of that data.frame. See the Match, Enter, and Exit section for more information.

Value

A keyframe_generator object

See Also

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

Examples

gen <- gen_at(mtcars[1:6, ], mtcars[6:1, ], 'cubic-in-out')

get_frame(gen, 0.3)

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