create_pattern_stripe: Create an SVG stripe pattern

Description Usage Arguments Value Examples

View source: R/pattern-stripe.R

Description

Create an SVG pattern which will fill an element with stripes.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
create_pattern_stripe(
  id,
  angle = 45,
  spacing = 20,
  fill_fraction = 0.2,
  alpha = 1,
  fg_alpha = 1,
  colour = "#000000",
  ...
)

Arguments

id

id to use for pattern. If NULL then generate rando ID

angle

rotation angle (degrees)

spacing

space between features

fill_fraction

size of features. In range [0, 1]

alpha

default: 1.0 (opaque)

fg_alpha

alpha of the features

colour

colour of the features. e.g. '#345678'

...

other arguments ignored

Value

minisvg::SVGPattern object

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

# Create the pattern and add to the SVG definitions
my_pattern <- create_pattern_stripe(id = 'mypattern')
doc$defs(my_pattern)

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

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

## End(Not run)

coolbutuseless/svgpatternsimple documentation built on Feb. 9, 2020, 12:20 a.m.