create_anim_rotation: Create a simple rotation animation

Description Usage Arguments Value Examples

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

Description

Create a simple rotation animation

Usage

1
2
3
4
5
6
7
create_anim_rotation(
  duration = 16,
  cx = 0,
  cy = 0,
  repeatCount = "indefinite",
  ...
)

Arguments

duration

time for full rotate (seconds). default: 16

cx, cy

centre of rotation. default (0, 0)

repeatCount

default: 'indefinite'

...

other arguments passed to minisvg::stag$animateTransform()

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
## Not run: 
# Create an SVG document
library(minisvg)
doc   <- minisvg::svg_doc()

# Create the animation
rot   <- create_anim_rotation(cx = 200, cy = 200)

# Create a rectangle with the animation
rect  <- stag$rect(
  x      = "10%",
  y      = "10%",
  width  = "80%",
  height = "80%",
  fill   = "lightblue",
  stroke = 'black',
  rot
)

# 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.