This function implements the rainbow smoke algorithm.
a string or character vector specifying the color(s) used for the artwork.
an integer larger than zero and lower than or equal to resolution^2
specifying the initial number of pixels to color on the canvas.
a character indicating the shape of the smoke. Possible options are burst
and clouds
.
a character specifying how to select a new pixel. The default option minimum
selects the pixel with the smallest color difference in a single neighbor and is relatively fast. The option average
selects the pixel with the smallest average color difference in all the neighbors and is relatively slow.
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(1)
# Simple example
canvas_smoke(colors = "all", resolution = 500)
# Advanced example
reds <- colorRampPalette(c("red", "black"))
blues <- colorRampPalette(c("goldenrod", "navyblue"))
palette <- c(reds(100), blues(100))
canvas_smoke(colors = palette, init = 3, shape = "clouds", resolution = 500)
# }