File: tween_elements.Rd

package info (click to toggle)
r-cran-tweenr 2.0.2-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,060 kB
  • sloc: cpp: 1,052; ansic: 558; sh: 13; makefile: 2
file content (59 lines) | stat: -rw-r--r-- 1,972 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/tween_elements.R
\name{tween_elements}
\alias{tween_elements}
\title{Create frames based on individual element states}
\usage{
tween_elements(data, time, group, ease, timerange, nframes)
}
\arguments{
\item{data}{A data.frame consisting at least of a column giving the
observation id, a column giving timepoints for each state and a column giving
the easing to apply when transitioning away from the state.}

\item{time}{The name of the column holding timepoints}

\item{group}{The name of the column holding the observation id}

\item{ease}{The name of the column holding the easing function name}

\item{timerange}{The range of time to span. If missing it will default to
\code{range(data[[time]])}}

\item{nframes}{The number of frames to generate. If missing it will default
to \code{ceiling(diff(timerange) + 1)} (At least one frame for each
individual timepoint)}
}
\value{
A data.frame with the same columns as \code{data} except for the
group and ease columns, but replicated \code{nframes} times. Two additional
columns called \code{.frame} and \code{.group} will be added giving the frame
number and observation id for each row.
}
\description{
This function creates tweens for each observation individually, in cases
where the data doesn't pass through collective states but consists of fully
independent transitions. Each observation is identified by an id and each
state must have a time associated with it.
}
\examples{
data <- data.frame(
  x = c(1, 2, 2, 1, 2, 2),
  y = c(1, 2, 2, 2, 1, 1),
  time = c(1, 4, 10, 4, 8, 10),
  group = c(1, 1, 1, 2, 2, 2),
  ease = rep('cubic-in-out', 6)
)

data <- tween_elements(data, 'time', 'group', 'ease', nframes = 100)

}
\seealso{
Other data.frame tween: 
\code{\link{tween_along}()},
\code{\link{tween_appear}()},
\code{\link{tween_components}()},
\code{\link{tween_events}()},
\code{\link{tween_states}()}
}
\concept{data.frame tween}