| gen_events {tweenr} | R Documentation | 
Generator for tweening the appearance of elements
Description
This is a generator version of tween_events(). 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_events(
  .data,
  ease,
  start,
  end = NULL,
  range = NULL,
  enter = NULL,
  exit = NULL,
  enter_length = 0,
  exit_length = 0
)
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. | 
| start,end | The start (and potential end) of the event encoded in the
row, as unquoted expressions. Will be evaluated in the context of  | 
| range | The range of time points to include in the tween. If  | 
| enter,exit | functions that calculate a start state for new observations
that appear in  | 
| enter_length,exit_length | The lenght of the opening and closing
transitions if  | 
Value
A component_generator object
See Also
Other Other generators: 
gen_along(),
gen_at(),
gen_components(),
gen_keyframe()
Examples
d <- data.frame(
  x = runif(20),
  y = runif(20),
  time = runif(20),
  duration = runif(20, max = 0.1)
)
from_left <- function(x) {
  x$x <- -0.5
  x
}
to_right <- function(x) {
  x$x <- 1.5
  x
}
gen <- gen_events(d, 'cubic-in-out', start = time, end = time + duration,
                  enter = from_left, exit = to_right, enter_length = 0.1,
                  exit_length = 0.05)
get_frame(gen, 0.65)