This tween is a variation of tween_at(). Instead of having at refer to the tweening position of each row, each at will interpolate the full data at that position.

tween_at_t(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 vector with values between 0 and 1.

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_t(mtcars[1:6, ], mtcars[6:1, ], runif(3), 'cubic-in-out')
#> Warning: corrupt data frame: columns will be truncated or padded with NAs
#>         mpg      cyl     disp        hp     drat       wt     qsec         vs
#> 1  18.13232 6.000000 224.2756 105.05572 2.772705 3.450638 20.17810 0.98885518
#> 2  18.72563 7.977710 357.7710 174.27559 3.158359 3.433703 17.02000 0.00000000
#> 3  21.41560 5.977710 256.3283 109.81054 3.088582 3.205025 19.43075 1.00000000
#> 4  22.78440 4.022290 109.6717  93.18946 3.841418 2.329975 18.61925 1.00000000
#> 5  20.97437 6.022290 162.2290 110.72441 3.891641 2.881297 17.02000 0.00000000
#> 6  20.96768 6.000000 160.7244 109.94428 3.887295 2.629362 16.50190 0.01114482
#> 7  18.14874 6.000000 223.9074 105.08404 2.779162 3.445881 20.15680 0.98319152
#> 8  18.73866 7.966383 356.6383 173.90745 3.162606 3.430503 17.02000 0.00000000
#> 9  21.42353 5.966383 255.4787 109.71426 3.092943 3.199956 19.42605 1.00000000
#> 10 22.77647 4.033617 110.5213  93.28574 3.837057 2.335044 18.62395 1.00000000
#> 11 20.96134 6.033617 163.3617 111.09255 3.887394 2.884497 17.02000 0.00000000
#> 12 20.95126 6.000000 161.0926 109.91596 3.880838 2.634119 16.52320 0.01680848
#> 13 18.11939 6.000000 224.5653 105.03344 2.767624 3.454382 20.19485 0.99331240
#> 14 18.71538 7.986625 358.6625 174.56531 3.155016 3.436222 17.02000 0.00000000
#> 15 21.40936 5.986625 256.9969 109.88631 3.085149 3.209015 19.43445 1.00000000
#> 16 22.79064 4.013375 109.0031  93.11369 3.844851 2.325985 18.61555 1.00000000
#> 17 20.98462 6.013375 161.3375 110.43469 3.894984 2.878778 17.02000 0.00000000
#> 18 20.98061 6.000000 160.4347 109.96656 3.892376 2.625618 16.48515 0.00668760
#>            am     gear     carb NA
#> 1  0.01114482 3.011145 1.033434  1
#> 2  0.01114482 3.011145 2.022290  1
#> 3  0.01114482 3.011145 1.000000  1
#> 4  0.98885518 3.988855 1.000000  1
#> 5  0.98885518 3.988855 3.977710  1
#> 6  0.98885518 3.988855 3.966566  1
#> 7  0.01680848 3.016808 1.050425  1
#> 8  0.01680848 3.016808 2.033617  1
#> 9  0.01680848 3.016808 1.000000  1
#> 10 0.98319152 3.983192 1.000000  1
#> 11 0.98319152 3.983192 3.966383  1
#> 12 0.98319152 3.983192 3.949575  1
#> 13 0.00668760 3.006688 1.020063  1
#> 14 0.00668760 3.006688 2.013375  1
#> 15 0.00668760 3.006688 1.000000  1
#> 16 0.99331240 3.993312 1.000000  1
#> 17 0.99331240 3.993312 3.986625  1
#> 18 0.99331240 3.993312 3.979937  1