This function paints random squares and rectangles. It works by repeatedly cutting into the canvas at random locations and coloring the area that these cuts create.

canvas_squares(
  colors,
  background = "#000000",
  cuts = 50,
  ratio = 1.618,
  resolution = 200,
  noise = FALSE
)

Arguments

colors

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

background

a character specifying the color used for the borders of the squares.

cuts

a positive integer specifying the number of cuts to make.

ratio

a value specifying the 1:1 ratio for each cut.

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.

noise

logical. Whether to add k-nn noise to the artwork. Note that adding noise increases computation time significantly in large dimensions.

Value

A ggplot object containing the artwork.

See also

colorPalette

Author

Koen Derks, koen-derks@hotmail.com

Examples

# \donttest{
set.seed(1)

# Simple example
canvas_squares(colors = colorPalette("retro2"))

# }