This function draws swirling stripes on a canvas by simulating a particle system.

canvas_swirls(
  colors,
  background = "#fafafa",
  iterations = 250,
  n = 250,
  curvature = 0.005,
  lwd = 0.1,
  resolution = 500
)

Arguments

colors

a character (vector) specifying the color(s) used for the artwork.

background

a character specifying the color used for the background.

iterations

a positive integer specifying the number of iterations of the algorithm.

n

a positive integer specifying the number of particles.

curvature

a positive number specifying the curvature of the lines. Larger values imply relatively curved lines, while lower values produce relatively straight lines.

lwd

expansion factor for the line width.

resolution

resolution of the artwork in pixels per row/column. Increasing the resolution increases the quality of the artwork but also increases the computation time exponentially.

Value

A ggplot object containing the artwork.

See also

colorPalette

Author

Koen Derks, koen-derks@hotmail.com

Examples

# \donttest{
set.seed(2)

# Simple example
canvas_swirls(colors = colorPalette("origami"))

# }