canvas_slime | R Documentation |
This function draws the Physarum polycephalum slime mold on a canvas. The algorithm simulates particles on a two-dimensional grid that move towards areas on the grid with a high intensity.
canvas_slime(
colors,
background = "#000000",
iterations = 2000,
agents = 1000,
layout = c(
"random", "gaussian", "circle", "grid",
"clusters", "arrows", "wave", "spiral"
),
resolution = 1000
)
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. |
agents |
a positive integer specifying the number of agents to use. |
layout |
a character specifying the initial layout of the agents.
Possible options are |
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://cargocollective.com/sagejenson/physarum
https://fronkonstin.com/2020/08/11/abstractions/
colorPalette
set.seed(1)
# Simple example
canvas_slime(colors = colorPalette("neon1"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.