anim_scale {omsvg} | R Documentation |
Animate an element through scaling
Description
Within an anims()
call, itself passed to any anims
argument, the
anim_scale()
function can be used to express an animation where the target
element undergoes a scaling change with time.
Usage
anim_scale(scale = NULL, easing_fn = NULL)
Arguments
scale |
The scale value of the element at the keyframe time (given as
the LHS value in the |
easing_fn |
The timing or easing function to use for the animation. If
not provided, the |
Value
An anim_opacity
object, which is to be used as part of an anims()
call.
Examples
if (interactive()) {
# Basic animation of an element's
# scaling state (moving to a new
# `scale` value)
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_scale(scale = 2)
)
)
}