Title: | Generative Art |
---|---|
Description: | It doesn't do much, really. |
Authors: | Danielle Navarro [aut, cre] |
Maintainer: | Danielle Navarro <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.0.0.9001 |
Built: | 2024-11-17 03:40:55 UTC |
Source: | https://github.com/djnavarro/jasmines |
Convert image to hex
as_hex( from, to, text_label = NULL, text_colour = "white", border_colour = "grey20", border_opacity = 60 )
as_hex( from, to, text_label = NULL, text_colour = "white", border_colour = "grey20", border_opacity = 60 )
from |
Path to original file |
to |
Path to destination file |
text_label |
Text annotation |
text_colour |
Colour of text annotation |
border_colour |
Colour of the border region |
border_opacity |
Opacity of the border region |
Entity types
entity_circle(seed = use_seed(1), grain = 50, id = NULL, ...) entity_line(seed = use_seed(1), grain = 50, id = NULL, ...) entity_heart(seed = use_seed(1), grain = 50, id = NULL, ...) entity_droplet(seed = use_seed(1), grain = 50, id = NULL, shape = 3, ...) entity_lissajous( seed = use_seed(1), grain = 500, id = NULL, start = 0, end = 30, shape = list(a = 1, b = 1, w = 0.3, d = 1), ... ) entity_gaussian(seed = use_seed(1), grain = 50, id = NULL, ...) entity_null(seed = use_seed(1), ...)
entity_circle(seed = use_seed(1), grain = 50, id = NULL, ...) entity_line(seed = use_seed(1), grain = 50, id = NULL, ...) entity_heart(seed = use_seed(1), grain = 50, id = NULL, ...) entity_droplet(seed = use_seed(1), grain = 50, id = NULL, shape = 3, ...) entity_lissajous( seed = use_seed(1), grain = 500, id = NULL, start = 0, end = 30, shape = list(a = 1, b = 1, w = 0.3, d = 1), ... ) entity_gaussian(seed = use_seed(1), grain = 50, id = NULL, ...) entity_null(seed = use_seed(1), ...)
seed |
Parameter specifying seed (default = NULL) |
grain |
The number of points that comprise the entity |
id |
A numeric identifier for the entity |
... |
Parameters to be passed to locate_entity |
shape |
Parameter controlling the shape of the entity (droplet, lissajous) |
start |
Parameter controlling a start location for a line (lissajous) |
end |
Parameter controlling an end location for a line (lissajous) |
Primitive entities in jasmines are tibbles with four columns: x and y specify co-ordinate values, the id is a number identifying the object, and the type is a character label indicating what kind of entity it is. By default, entities are assigned a random integer as the id code, but it is often wise for the calling function to assign the id in a more predictable fashion. The shape parameter can sometimes be a list.
A tibble with four columns: x, y, id and type
Export animation to a file
export_animation(input, filename, nframes = 200, detail = 5, type = "cairo")
export_animation(input, filename, nframes = 200, detail = 5, type = "cairo")
input |
art object to print |
filename |
filename |
nframes |
defaults to 200 |
detail |
number of interpolated frames, defaults to 5 |
type |
defaults to "cairo" |
Export image to a file
export_image( input, filename, width = 10, height = 10, dpi = 300, xlim = NULL, ylim = NULL )
export_image( input, filename, width = 10, height = 10, dpi = 300, xlim = NULL, ylim = NULL )
input |
art object to print |
filename |
filename |
width |
defaults to 3000 pixels (10in at 300dpi) |
height |
defaults to 3000 pixels (10in at 300dpi) |
dpi |
defaults to 300dpi |
xlim |
by default plot limits are c(-.05, 1.05), relative to data spanning c(0, 1), but can override |
ylim |
by default plot limits are c(-.05, 1.05), relative to data spanning c(0, 1), but can override |
Locate entities
locate_entity(entity, xpos = 0, ypos = 0, size = 1, angle = 0, ...)
locate_entity(entity, xpos = 0, ypos = 0, size = 1, angle = 0, ...)
entity |
The entity to be placed |
xpos |
The horizontal location of the entity |
ypos |
The vertical location of the entity |
size |
Parameter controlling the size of the entity |
angle |
Parameter controlling the orientation of the entity |
... |
Other arguments are ignored |
When a jasmine entity is created it is implicitly assumed to be located at the origin (xpos = 0, ypos = 0), to have size 1, and to have a horizontal orientation (angle = 0). The locate_entity function allows the entity to be transformed in simple ways: translation, dilation and rotations
A tibble with four columns: x, y, id and type
Function factory for adjusted palettes
palette_adjust(name, prefix, ...)
palette_adjust(name, prefix, ...)
name |
Name of the base palette |
prefix |
Vector of colours to preprend to the named palette |
... |
Arguments to be passed to grDevices::adjustcolor |
A modified
Function factory for manual palettes
palette_manual(...)
palette_manual(...)
... |
colour names |
a function that takes arguments n and alpha
Function factory for prespecified palettes
palette_named(name = NULL, ...)
palette_named(name = NULL, ...)
name |
name of the palette |
... |
arguments to be passed to other functions |
a function that takes arguments n and alpha
Create a scene comprised of circles of varying size and location
scene_bubbles(seed = use_seed(1), n = 2, grain = 100)
scene_bubbles(seed = use_seed(1), n = 2, grain = 100)
seed |
Seed number to attach |
n |
Number of circles |
grain |
The number of points per row |
A tibble with four columns: x, y, id and type
Create a scene using Delaunay triangulation
scene_delaunay(seed = use_seed(1), n = 20, grain = 50)
scene_delaunay(seed = use_seed(1), n = 20, grain = 50)
seed |
The RNG seed |
n |
Number of vertices |
grain |
Number of points along each line |
A tibble with four columns: x, y, id and type
Create a scene comprised of concentric circles
scene_discs(seed = use_seed(1), points = 100, rings = 3, size = 2)
scene_discs(seed = use_seed(1), points = 100, rings = 3, size = 2)
seed |
Seed number to attach |
points |
Total number of interior points |
rings |
How many rings to spread across? |
size |
Diameter of the outermost ring |
Create a scene with entities on a grid
scene_grid( seed = use_seed(1), xpos = 1:3, ypos = 1:3, entity = "circle", grain = 50, size = 1, shape = 3, angle = 0 )
scene_grid( seed = use_seed(1), xpos = 1:3, ypos = 1:3, entity = "circle", grain = 50, size = 1, shape = 3, angle = 0 )
seed |
Seed number to attach |
xpos |
Numeric vector specifying horizontal locations |
ypos |
Numeric vector specifying vertical locations |
entity |
The entity type (e.g., "line", "circle") |
grain |
The number of points per entity |
size |
The size of each entity |
shape |
The shape of each entity |
angle |
The angle of each entity |
The scene_grid()
function allows multiple entities to be
included in the initial object, laying out items in grid.
A tibble with four columns: x, y, id and type
Create a scene with entities placed randomly
scene_mix( seed = use_seed(1), n = 5, xpos = (1:20)/4, ypos = (1:20)/4, entity = c("circle", "line", "heart", "droplet"), grain = 100, size = (10:20)/20, shape = 3, angle = seq(0, 2 * pi, length.out = 20) )
scene_mix( seed = use_seed(1), n = 5, xpos = (1:20)/4, ypos = (1:20)/4, entity = c("circle", "line", "heart", "droplet"), grain = 100, size = (10:20)/20, shape = 3, angle = seq(0, 2 * pi, length.out = 20) )
seed |
Seed number to attach |
n |
Number of entities |
xpos |
Numeric vector specifying possible horizontal locations |
ypos |
Numeric vector specifying possible vertical locations |
entity |
Character vector specifying possible entity types (e.g., "line", "circle") |
grain |
Numeric vector specifying possible grains |
size |
Numeric vector specifying possible sizes |
shape |
Numeric vector specifying possible shapes |
angle |
Numeric vector specifying possible angles |
A tibble with four columns: x, y, id and type
Create a scene comprised of horizontal or vertical lines
scene_rows(seed = use_seed(1), n = 10, grain = 100, vertical = FALSE)
scene_rows(seed = use_seed(1), n = 10, grain = 100, vertical = FALSE)
seed |
Seed number to attach |
n |
Number of rows |
grain |
The number of points per row |
vertical |
Flip the x/y co-ords to produce columns? |
A tibble with columns: x, y, id, type, seed
Create a scene comprised of lines of varying length and orientation
scene_sticks(seed = use_seed(1), n = 10, grain = 100)
scene_sticks(seed = use_seed(1), n = 10, grain = 100)
seed |
Seed number to attach |
n |
how many sticks |
grain |
how many points along each stick |
a tibble with columns x, y and id
Adds an overlay to the existing plot
style_overlay(pic, border = NULL, fill = NULL, linewidth = 1, data = NULL)
style_overlay(pic, border = NULL, fill = NULL, linewidth = 1, data = NULL)
pic |
Existing plot |
border |
Colour of border |
fill |
Colour of fill |
linewidth |
Width of border |
data |
Data to be shown in overlay (if NULL, taken from pic) |
Style as a pop art image
style_pop( data, palette = "base", colour = "ind", alpha = 0.3, fade = 0, background = "warhol", adjust = 0.7, panels = 4, ... )
style_pop( data, palette = "base", colour = "ind", alpha = 0.3, fade = 0, background = "warhol", adjust = 0.7, panels = 4, ... )
data |
data frame with x, y, order, id, time |
palette |
function generating a palette (or string naming the palette) |
colour |
name of variable to use to specify the colour aesthetic |
alpha |
length two numeric, first element is the initial alpha, (optional) second is the decay rate for alpha |
background |
colour of the background in the plot |
... |
arguments to pass to geom |
Returns a ggplot2 object
Style as a ribbon image
style_ribbon( data, palette = "viridis", colour = "order", alpha = c(0.3, 0), background = "black", discard = 0, type = "segment", ... )
style_ribbon( data, palette = "viridis", colour = "order", alpha = c(0.3, 0), background = "black", discard = 0, type = "segment", ... )
data |
data frame with x, y, order, id, time |
palette |
function generating a palette (or string naming the palette) |
colour |
name of variable to use to specify the colour aesthetic |
alpha |
length two numeric, first element is the initial alpha, (optional) second is the decay rate for alpha |
background |
colour of the background in the plot |
discard |
how many iterations should we discard before drawing? |
type |
type of geom to use ("segment", "curve" or "point") |
... |
arguments to pass to geom |
Returns a ggplot2 object
Style as animated points
style_walk( data = unfold_meander(), wake_length = 0.1, palette = palette_scico(palette = "berlin"), background = "black", ... )
style_walk( data = unfold_meander(), wake_length = 0.1, palette = palette_scico(palette = "berlin"), background = "black", ... )
data |
tibble specifying the time series |
wake_length |
length of the tail |
palette |
function generating palette values |
background |
colour of the background |
... |
other arguments to pass to shadow_wake The |
The output is a gganim object
Unfold a scene with a swirl operation
unfold_breeze( data = scene_sticks(), iterations = 6, scale = 0.02, drift = 0.01, noise = NULL, fractal = NULL, octaves = 8, output = "time", ... )
unfold_breeze( data = scene_sticks(), iterations = 6, scale = 0.02, drift = 0.01, noise = NULL, fractal = NULL, octaves = 8, output = "time", ... )
data |
data frame with x, y, id, and more |
iterations |
how many times should we iterate? |
scale |
how large is each step? |
drift |
gaussian noise to inject at each step |
noise |
noise function (default is ambient::gen_simplex) |
fractal |
fractal function (default is ambient::billow) |
octaves |
default = 8 |
output |
name of the unfolding variable to add (e.g., time) |
... |
arguments to pass to ambient::fracture |
a "tempest" ribbon, data frame with x, y, order, time and id
Unfold a scene with an inside operation
unfold_inside(data, output = "inside")
unfold_inside(data, output = "inside")
data |
Data |
output |
String specifying a Column name |
Returns the original data tibble with a new column added
Unfold a scene with a loop operation
unfold_loop(data, points = 20, radius = 1)
unfold_loop(data, points = 20, radius = 1)
data |
data |
points |
number of time points |
radius |
radius of the circle |
a tibble with x, y, id and time
Unfold a scene with a meander operation
unfold_meander( data = entity_circle(), iterations = 100, smoothing = 6, endpause = 0, output1 = "time", output2 = "series" )
unfold_meander( data = entity_circle(), iterations = 100, smoothing = 6, endpause = 0, output1 = "time", output2 = "series" )
data |
data frame with x, y, etc |
iterations |
number of time points in the time series |
smoothing |
number of smoothing iterations |
endpause |
length of pause at the end |
output1 |
name of the primary unfolding variable to add (e.g., time) |
output2 |
name of the secondary unfolding variable to add (e.g., series) |
tibble with columns series, time, x, y
Unfold a scene with a slice operation
unfold_slice( data = scene_sticks(), iterations = 6, scale = 0.2, scatter = FALSE, output1 = "time", output2 = "order" )
unfold_slice( data = scene_sticks(), iterations = 6, scale = 0.2, scatter = FALSE, output1 = "time", output2 = "order" )
data |
data frame with x, y, id, and more |
iterations |
how many times should we iterate the curl noise? |
scale |
how large is each curl step? |
scatter |
should the noise seed be "scattered"? |
output1 |
name of the primary unfolding variable to add (e.g., time) |
output2 |
name of the secondary unfolding variable to add (e.g., order) |
a "tempest" ribbon, data frame with x, y, order, time and id
Unfold a scene with a tempest operation
unfold_tempest( data = scene_sticks(), iterations = 6, scale = 0.02, scatter = FALSE, output1 = "time", output2 = "order" )
unfold_tempest( data = scene_sticks(), iterations = 6, scale = 0.02, scatter = FALSE, output1 = "time", output2 = "order" )
data |
data frame with x, y, id, and more |
iterations |
how many times should we iterate the curl noise? |
scale |
how large is each curl step? |
scatter |
should the noise seed be "scattered"? |
output1 |
name of the primary unfolding variable to add (e.g., time) |
output2 |
name of the secondary unfolding variable to add (e.g., order) |
a "tempest" ribbon, data frame with x, y, order, time and id
Unfold a scene with a warp operation
unfold_warp( data = scene_sticks(), iterations = 6, scale = 0.02, scatter = FALSE, output = "time" )
unfold_warp( data = scene_sticks(), iterations = 6, scale = 0.02, scatter = FALSE, output = "time" )
data |
data frame with x, y, id, and more |
iterations |
how many times should we iterate the noise? |
scale |
how large is each step? |
scatter |
should the noise seed be "scattered"? |
output |
name of the output variable (default = time) |
thing
Unfold a scene with a worley operation
unfold_worley(data, scatter = FALSE, output = "order", ...)
unfold_worley(data, scatter = FALSE, output = "order", ...)
data |
the data object |
scatter |
should the noise seed be "scattered"? |
output |
name of the primary unfolding variable to add (e.g., order) |
... |
arguments to pass to ambient::genworley() |
Wrapper to set.seed
use_seed(seed = 1)
use_seed(seed = 1)
seed |
the seed value |