canvas_flame | R Documentation |
This function implements the fractal flame algorithm.
canvas_flame(
colors,
background = "#000000",
iterations = 1000000,
variations = 0,
symmetry = 0,
blend = TRUE,
weighted = FALSE,
post = FALSE,
final = FALSE,
extra = FALSE,
display = c("colored", "logdensity"),
zoom = 1,
resolution = 1000,
gamma = 1
)
colors |
a string or 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. Using more iterations results in images of higher quality but also increases the computation time. |
variations |
an integer (vector) with a minimum of 0 and a maximum of 48 specifying the variations to be included in the flame. The default |
symmetry |
an integer with a minimum of -6 and a maximum of 6 indicating the type of symmetry to include in the flame. The default |
blend |
logical. Whether to blend the variations ( |
weighted |
logical. Whether to weigh the functions and the variations ( |
post |
logical. Whether to apply a post transformation in each iteration. |
final |
logical. Whether to apply a final transformation in each iteration. |
extra |
logical. Whether to apply an additional post transformation after the final transformation. Only has an effect when |
display |
a character indicating how to display the flame. |
zoom |
a positive value specifying the amount of zooming. |
resolution |
resolution of the artwork in pixels per row/column. Increasing the resolution does not increases the computation time of this algorithm. |
gamma |
a numeric value specifying the gamma correction (only used when |
The variation
argument can be used to include specific variations into the flame. See the appendix in the references for examples of all variations. Possible variations are:
0
: Linear (default)
1
: Sinusoidal
2
: Spherical
3
: Swirl
4
: Horsehoe
5
: Polar
6
: Handkerchief
7
: Heart
8
: Disc
9
: Spiral
10
: Hyperbolic
11
: Diamond
12
: Ex
13
: Julia
14
: Bent
15
: Waves
16
: Fisheye
17
: Popcorn
18
: Exponential
19
: Power
20
: Cosine
21
: Rings
22
: Fan
23
: Blob
24
: PDJ
25
: Fan2
26
: Rings2
27
: Eyefish
28
: Bubble
29
: Cylinder
30
: Perspective
31
: Noise
32
: JuliaN
33
: JuliaScope
34
: Blur
35
: Gaussian
36
: RadialBlur
37
: Pie
38
: Ngon
39
: Curl
40
: Rectangles
41
: Arch
42
: Tangent
43
: Square
44
: Rays
45
: Blade
46
: Secant
47
: Twintrian
48
: Cross
The symmetry
argument can be used to include symmetry into the flame. Possible options are:
0
: No symmetry (default)
-1
: Dihedral symmetry
1
: Two-way rotational symmetry
(-)2
: (Dihedral) Three-way rotational symmetry
(-)3
: (Dihedral) Four-way rotational symmetry
(-)4
: (Dihedral) Five-way rotational symmetry
(-)5
: (Dihedral) Six-way rotational symmetry
(-)6
: (Dihedral) Snowflake symmetry
A ggplot
object containing the artwork.
Koen Derks, koen-derks@hotmail.com
https://flam3.com/flame_draves.pdf
colorPalette
set.seed(3)
# Simple example, linear variation, relatively few iterations
canvas_flame(colors = c("dodgerblue", "green"), variations = 0)
# Simple example, linear variation, dihedral symmetry
canvas_flame(colors = c("hotpink", "yellow"), variations = 0, symmetry = -1, iterations = 1e7)
# Advanced example (no-blend, weighted, sinusoidal and spherical variations)
canvas_flame(
colors = colorPalette("origami"), variations = c(1, 2),
blend = FALSE, weighted = TRUE, iterations = 1e8
)
# More iterations give much better images
set.seed(123)
canvas_flame(colors = c("red", "blue"), iterations = 1e8, variations = c(10, 17))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.