# NOT RUN {
if (interactive()) {
# Create an SVG with a single
# rectangle element
svg_1 <-
SVG(width = 100, height = 100) %>%
svg_rect(
x = 20, y = 10,
width = 40, height = 15,
stroke = "blue", fill = "yellow"
)
# Create an SVG with a single
# rectangle element that moves
# to new `x` positions
svg_2 <-
SVG(width = 300, height = 300) %>%
svg_rect(
x = 50, y = 50,
width = 50, height = 50,
stroke = "magenta", fill = "lightblue",
anims = anims(
0.5 ~ list(
anim_position(
x = 50, y = 50,
easing_fn = ease_out()
),
anim_rotation(rotation = 0)
),
2.0 ~ list(
anim_position(
x = 200, y = 50,
easing_fn = ease_in_out()
),
anim_rotation(rotation = 90)
)
)
)
}
# }
Run the code above in your browser using DataLab