Skip to content

arturocm/tweenr

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tweenr

Travis-CI Build Status

What is this?

tweenr is a small package that makes it easy to interpolate your data between different states, specifying the length of each change, the easing of the transition and how many intermediary steps should be generated. tweenr works particularly well with gganimate but can be used for any case where interpolation of data is needed. All functions are vectorized so in any case you'll get better performance than using approx and colorRamp.

tweenr

tweening of 9 states of data

How does it work?

Installation is currently through the use of devtools but the package will eventually land on CRAN:

if (!require(devtools)) {
    install.packages("devtools")
}
devtools::install_github("thomasp85/tweenr")

Once you have it there are currently three ways to tween your data. Furthermore there is also access to standard vectorized interpolaters for the following classes:

  • numeric
  • Date
  • POSIXt
  • colour (not really a class - any string that can be considered a colour)

tween_states

tween_states takes a list of data.frames, each representing a state of your data, and interpolates the transition between them. Only the first data.frame needs to be full, the following only needs to contain the columns that shows any change. It is possible to specify the length of each individual transition, as well as the length of the pause at each state. Each transition can also have an easing function assiciated with it that describes how the transition should progress.

tween_appear

This simple function is for data that describes events in time. It converts the data into frames and assigns an age to each observation in each frame. A negative age means that the observation has yet to appear.

tween_elements

This function is the most versatile of them all. It takes a data.frame that contains a time column, a observation.id column and an ease column along with the rest of the data. Each observation, defined by the observation.id, is animated through its individual states, using its own easing function.

About

Interpolate your data

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • R 43.9%
  • C++ 39.2%
  • C 16.9%