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
)
a character (vector) specifying the color(s) used for the artwork.
a character specifying the color used for the background.
a positive integer specifying the number of iterations of the algorithm.
a positive integer specifying the number of particles.
a positive number specifying the curvature of the lines. Larger values imply relatively curved lines, while lower values produce relatively straight lines.
expansion factor for the line width.
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.
A ggplot
object containing the artwork.
colorPalette
# \donttest{
set.seed(2)
# Simple example
canvas_swirls(colors = colorPalette("origami"))
# }