Skip to contents

Convenience constructor for a two-value property animation that runs from from to to. An optional CSS unit suffix is concatenated into both values during serialisation (e.g. 100 with unit = "px" becomes "100px").

Usage

anime_from_to(from, to, unit = "", ease = NULL)

Arguments

from

Numeric. Starting value.

to

Numeric. Ending value.

unit

Character. Optional CSS unit suffix, e.g. "px", "%", "deg".

ease

Optional easing override for this property alone, an anime_easing object or an Anime.js easing name string.

Value

An anime_from_to object.

Examples

anime_from_to(0, 1)
#> $from
#> [1] 0
#> 
#> $to
#> [1] 1
#> 
#> $unit
#> [1] ""
#> 
#> $ease
#> NULL
#> 
#> attr(,"class")
#> [1] "anime_from_to"
anime_from_to(0, 360, unit = "deg")
#> $from
#> [1] 0
#> 
#> $to
#> [1] 360
#> 
#> $unit
#> [1] "deg"
#> 
#> $ease
#> NULL
#> 
#> attr(,"class")
#> [1] "anime_from_to"
anime_from_to(0, 1, ease = anime_easing_spring())
#> $from
#> [1] 0
#> 
#> $to
#> [1] 1
#> 
#> $unit
#> [1] ""
#> 
#> $ease
#> $name
#> [1] "spring"
#> 
#> $params
#> $params$bounce
#> [1] 0.5
#> 
#> $params$duration
#> [1] 628
#> 
#> 
#> attr(,"class")
#> [1] "anime_easing"
#> 
#> attr(,"class")
#> [1] "anime_from_to"