create_anim_stroke_render: Create an animation for the rendering of a stroke around an...

Description Usage Arguments Value Examples

View source: R/create-anim-stroke-render.R

Description

This animation will only show if the object it applies to (a) has a visible stroke, and (b) has the stroke-dasharray attribute set.

Usage

1
2
3
4
5
6
create_anim_stroke_render(
  offset = 2000,
  duration = 4,
  repeatCount = "indefinite",
  ...
)

Arguments

offset

The length of the offset motion. this will need to be adjusted depending on the overall stroke length. default: 2000

duration

time for full cycle (seconds). default: 4

repeatCount

default: 'indefinite'

...

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

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
stroke_render <- create_anim_stroke_render()

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

# Add this rectangle to the document, show the SVG text, then render it
doc$append(rect)
doc
doc$show()

## End(Not run)

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