Description Usage Arguments Value Examples
Within an anims()
call, itself passed to any anims
argument, the
anim_opacity()
function can be used to express an animation where the
target element undergoes a change in opacity with time.
1 | anim_opacity(opacity = NULL, easing_fn = NULL, initial = FALSE)
|
opacity |
The opacity 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 |
initial |
Should this opacity value be the initial opacity value of
the element? If so, use |
An anim_opacity
object, which is to be used as part of an anims()
call.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | if (interactive()) {
# Basic animation of an element's
# opacity value (moving to a new
# `opacity` value of `0`)
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_opacity(opacity = 0)
)
)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.