Learn R Programming

aRtsy (version 0.2.4)

canvas_swirls: Draw Swirls

Description

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

Usage

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

Value

A ggplot object containing the artwork.

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.

Author

Koen Derks, koen-derks@hotmail.com

References

https://mattdesl.svbtle.com/generative-art-with-nodejs-and-canvas

See Also

colorPalette

Examples

Run this code
# \donttest{
set.seed(2)

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

Run the code above in your browser using DataLab