Create simple animation of motion-along-a-path

create_anim_motion(duration = 4, xs, ys, repeatCount = "indefinite", ...)

Arguments

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::stag$animateMotion()

Value

minisvg SVGElement

Examples

if (FALSE) { # 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() }