create_anim_motion: Create simple animation of motion-along-a-path

Description Usage Arguments Value Examples

View source: R/create-anim-motion.R

Description

Create simple animation of motion-along-a-path

Usage

1
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

 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)

coolbutuseless/svganim documentation built on Feb. 2, 2020, 12:04 a.m.