Within an anims() call, itself passed to any anims argument, the
anim_position() function can be used to express an animation where the
position of the target element changes with time.
anim_position(x = NULL, y = NULL, easing_fn = NULL, initial = FALSE)
| x, y | The position of the element, expressed as |
|---|---|
| easing_fn | The timing or easing function to use for the animation. If
not provided, the |
| initial | Should this position be the initial position of the element?
If so, use |
# Basic animation of an element's # position (moving to a new `x` and # `y` position) SVG(width = 300, height = 300) %>% svg_rect( x = 50, y = 50, width = 50, height = 50, attrs = svg_attrs_pres( stroke = "magenta", fill = "lightblue" ), anims = anims( 2.0 ~ anim_position(x = 100, y = 50) ) )#> #> #> #> #> #> #> #> #> #> #> #> #> #> #> #> #> #> #> #> #> #> #> #> #> #> #> #>