Skip to contents

Core structure

The classes and generics that define how a sketch is built and rendered, independent of any specific drawable.

sketch()
A collection of drawable objects
canvas()
Canvas settings for a sketch
drawable()
Parent class for all drawable objects
draw()
Draw a drawable or sketch
xy()
A set of locations in 2D space
style()
Graphical style for a drawable object
group()
A nested collection of drawables sharing one transform/style

Two-dimensional shapes

Closed, fillable drawables (geometry = "polygon").

shape_bezier() shape_beziers()
A closed Bezier curve
shape_blob() shape_blobs()
An irregular, "blobby" circle
shape_circle() shape_circles()
A circle
shape_combine()
Combine several drawables into one multi-sub-path shape
shape_ellipse() shape_ellipses()
An ellipse
shape_polygon() shape_polygons()
A regular polygon
shape_raw() shape_raws()
A polygon defined directly by its vertices
shape_rectangle() shape_square() shape_rectangles() shape_squares()
A rectangle
shape_ribbon() shape_ribbons()
A tapered ribbon between two points
shape_star() shape_stars()
A star
shape_stroke() shape_strokes()
A tapered, pressure-modulated stroke along an arbitrary path
shape_strokepath() shape_strokepaths()
A ribbon following an arbitrary curve
shape_twist() shape_twists()
A twisted ribbon following a random path
shape_wedge() shape_wedges()
A pie-slice wedge or annulus segment

One-dimensional curves

Open, stroked drawables (geometry = "path").

curve_arc() curve_arcs()
An open arc
curve_bezier() curve_beziers()
An open Bezier curve
curve_line() curve_lines()
An open polyline
curve_raw() curve_raws()
An open path defined directly by its vertices
curve_scribble() curve_scribbles()
A wandering scribble curve
curve_spiral() curve_spirals()
An open spiral
curve_twist() curve_twists()
An open, wandering path following a random walk

Zero-dimensional points

Unconnected marker drawables (geometry = "points").

points_raw() points_raws()
A scatter of points defined directly by their coordinates

Noise tools

Scalar noise fields used to distort a shape’s points, used by shape_blob()/shape_ribbon()/shape_twist().

noise_bridge()
A smoothed Brownian bridge, as a path distortion
noise_field()
A sampled scalar noise field
noise_sample()
Sample a noise object

Fill tools

Textures and patterns for style()’s fill argument, used by 2D shapes.

fill()
A resolved or auto-resolving fill value
fill_charcoal()
Charcoal/marker-style noise texture fill
fill_checker()
Checkerboard pattern fill
fill_crosshatch()
Crosshatch pattern fill
fill_flow()
Domain-warped noise texture fill
fill_gradient()
Gradient fill
fill_halftone()
Halftone dot pattern fill
fill_hatch()
Diagonal hatch pattern fill
fill_image()
User-supplied raster image fill
fill_marble()
Marbled, veined texture fill
fill_noise()
Simplex/fractal noise texture fill
fill_none()
Unfilled (transparent) fill
fill_scatter()
Scattered-shape pattern fill
fill_scribble()
Wandering-line scribble texture fill
fill_solid()
Solid colour fill
fill_stipple()
Stippled dot pattern fill
fill_stripe()
Striped pattern fill
fill_vignette()
Vignette fill

Transformation tools

Transformations applied to a drawable’s computed points, used by every drawable’s trans property.

trans()
A 2D affine transformation
trans_affine()
Build a custom affine transform
trans_chain()
A sequence of composed transforms
trans_fn()
An arbitrary-function, non-rigid deformation
trans_identity()
The identity transform
trans_reflect()
Reflect points
trans_rotate()
Rotate points
trans_scale()
Scale points
trans_shear()
Shear points
trans_translate()
Translate points
trans_warp()
A non-rigid, noise-based deformation

Effects tools

Helpers that compose several drawables together for a particular visual effect, rather than constructing a single drawable.

effect_bristle()
A fanned bristle/dry-brush effect along a path
effect_grain()
A paper-grain/textured-ink rendering of a drawable's own outline
effect_swatch()
A colour-swatch effect: repeat a template drawable, one per colour
effect_tremor()
Layer jittered copies of a drawable for a hand-drawn look

Palette tools

Functions returning a plain character vector of colours, for use in style()’s color/fill arguments or any fill_*() helper’s own colour vector.

palette_cosine()
Colour palette from a linear cosine formula
palette_gradient()
Colour palette interpolated between user-supplied colours
palette_harmony()
Colour palette from hue-rotation colour-wheel harmonies
palette_manual()
Colour palette drawn from a curated collection
palette_tonal()
Colour palette from a monochromatic tint/shade ramp
palette_walk()
Colour palette from a bounded random walk through colour space

Colour operations

Functions that transform an existing character vector of colours (e.g. one returned by a palette_*() helper), for use in style()’s color/fill arguments or any fill_*() helper’s own colour vector.

color_alpha()
Set a colour vector's alpha (opacity)
color_greyscale()
Convert a colour vector to greyscale
color_invert()
Invert a colour vector
color_jitter()
Randomly perturb a colour vector
color_lighten() color_darken()
Lighten or darken a colour vector
color_mix()
Blend two colour vectors
color_rotate_hue()
Rotate a colour vector's hue
color_saturate() color_desaturate()
Saturate or desaturate a colour vector

Export tools

Save a drawable or sketch directly to an image file.

save_png() save_svg() save_pdf()
Save a drawable or sketch to an image file