Description Usage Arguments Value Examples
View source: R/create-anim-motion.R
Create simple animation of motion-along-a-path
1 | create_anim_motion(duration = 4, xs, ys, repeatCount = "indefinite", ...)
|
duration |
time for full motion (seconds). default: 4 |
xs, ys |
numeric vectors of x and y points on the path |
repeatCount |
default: 'indefinite' |
... |
other arguments passed to |
minisvg SVGElement
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | ## Not run:
# Create an SVG document
library(minisvg)
doc <- minisvg::svg_doc()
# Create the animation
motion <- create_anim_motion(
xs = c(20, 20, 80, 80),
ys=c(20, 80, 80, 20)
)
# Create a rectangle with the animation
rect <- stag$rect(
x = "10%",
y = "10%",
width = "30%",
height = "30%",
fill = "lightblue",
stroke = 'black',
motion
)
# Add this rectangle to the document, show the SVG text, then render it
doc$append(rect)
doc$show()
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.