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 20.98324 6.000000 160.3756 109.9711 3.893412 2.624854 16.48173 0.00577887
#> 2 18.70024 7.999790 359.9790 174.9932 3.150079 3.439941 17.02000 0.00000000
#> 3 21.64407 5.651332 231.8499 107.0363 3.214237 3.058971 19.29530 1.00000000
#> 4 21.40099 5.998590 257.8942 109.9880 3.080543 3.214369 19.43941 1.00000000
#> 5 19.67443 7.152673 275.2673 147.4619 3.467748 3.200630 17.02000 0.00000000
#> 6 18.39667 6.000000 218.3506 105.5115 2.876620 3.374069 19.83536 0.89770160
#>             am     gear     carb
#> 1 0.9942211305 3.994221 3.982663
#> 2 0.0001051921 3.000105 2.000210
#> 3 0.1743337770 3.174334 1.000000
#> 4 0.0007052164 3.000705 1.000000
#> 5 0.4236634424 3.423663 2.847327
#> 6 0.1022983988 3.102298 1.306895