This tween allows you to query a specific postion between two states rather than generate evenly spaced states. It can work with either data.frames or single vectors and each row/element can have its own position and easing.

tween_at(from, to, at, ease)

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

at

A numeric between 0 and 1 recycled to match the nrow/length of from

ease

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

Value

If from/to is a data.frame then a data.frame with the same columns. If from/to is a vector then a vector.

Examples

tween_at(mtcars[1:6, ], mtcars[6:1, ], runif(6), 'cubic-in-out')
#>        mpg      cyl     disp        hp     drat       wt     qsec        vs
#> 1 18.10006 6.000000 224.9986 105.00010 2.760024 3.459983 20.21992 0.9999792
#> 2 20.37123 6.546757 214.6757 127.76960 3.694966 3.029459 17.02000 0.0000000
#> 3 22.53682 4.375972 136.1979  96.19576 3.705251 2.488248 18.76603 1.0000000
#> 4 22.56503 4.335673 133.1755  95.85322 3.720766 2.470214 18.74930 1.0000000
#> 5 18.72722 7.976331 357.6331 174.23075 3.158876 3.433313 17.02000 0.0000000
#> 6 20.62273 6.000000 168.4561 109.34953 3.751694 2.729278 16.94915 0.1300931
#>             am     gear     carb
#> 1 2.082361e-05 3.000021 1.000062
#> 2 7.266215e-01 3.726621 3.453243
#> 3 8.120139e-01 3.812014 1.000000
#> 4 8.321634e-01 3.832163 1.000000
#> 5 1.183459e-02 3.011835 2.023669
#> 6 8.699069e-01 3.869907 3.609721