View source: R/canvas_swirls.R
canvas_swirls | R Documentation |
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
)
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. |
A ggplot
object containing the artwork.
Koen Derks, koen-derks@hotmail.com
https://mattdesl.svbtle.com/generative-art-with-nodejs-and-canvas
colorPalette
set.seed(2)
# Simple example
canvas_swirls(colors = colorPalette("origami"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.