(arc radius start-angle offset)(arc radius start-angle offset second-arg)(arc radius start-angle offset resolution style)(arc radius start-angle offset resolution style cx cy)Creates an arc (fraction of a circle). radius: radius of the arc start-angle: starting angle in radians offset: angular span of the arc in radians (can be negative to go backwards) resolution: number of points in the arc (default: 30) style: optional style map (default: {:stroke (p-color 0) :stroke-weight 1}) cx: center X coordinate (default: 0) cy: center Y coordinate (default: 0)
Supports multiple arities: (arc radius start-angle offset) - uses default resolution (30) and default style (arc radius start-angle offset resolution) - explicit resolution, default style (arc radius start-angle offset resolution style) - all parameters (arc radius start-angle offset style) - if 4th arg is a map, it's style, resolution defaults to 30
Creates an arc (fraction of a circle).
radius: radius of the arc
start-angle: starting angle in radians
offset: angular span of the arc in radians (can be negative to go backwards)
resolution: number of points in the arc (default: 30)
style: optional style map (default: {:stroke (p-color 0) :stroke-weight 1})
cx: center X coordinate (default: 0)
cy: center Y coordinate (default: 0)
Supports multiple arities:
(arc radius start-angle offset) - uses default resolution (30) and default style
(arc radius start-angle offset resolution) - explicit resolution, default style
(arc radius start-angle offset resolution style) - all parameters
(arc radius start-angle offset style) - if 4th arg is a map, it's style, resolution defaults to 30(cross color x y)A cross, can only be made as a pattern (because sshapes are continuous lines) which is why we only define it now
A cross, can only be made as a pattern (because sshapes are continuous lines) which is why we only define it now
(find-all-cycles points step)Find all distinct cycles when stepping through points by step size
Find all distinct cycles when stepping through points by step size
(find-cycle point-vec step start-idx visited)Find a single cycle starting from start-idx, returning [cycle-points new-visited]
Find a single cycle starting from start-idx, returning [cycle-points new-visited]
(hex-side-center radius side-index)Get the center point of a hexagon side. radius: distance from center to side center side-index: 0-5, where 0 is right side (angle 0), increasing counterclockwise
For a hexagon, side centers are evenly spaced at d60 (60°) intervals: side 0: angle 0 (right) side 1: angle d60 (top-right) side 2: angle (* 2 d60) (top-left) side 3: angle d180 (left) side 4: angle (* 4 d60) (bottom-left) side 5: angle (* 5 d60) (bottom-right)
Get the center point of a hexagon side. radius: distance from center to side center side-index: 0-5, where 0 is right side (angle 0), increasing counterclockwise For a hexagon, side centers are evenly spaced at d60 (60°) intervals: side 0: angle 0 (right) side 1: angle d60 (top-right) side 2: angle (* 2 d60) (top-left) side 3: angle d180 (left) side 4: angle (* 4 d60) (bottom-left) side 5: angle (* 5 d60) (bottom-right)
(ogee stretch)(ogee stretch second-arg)(ogee stretch resolution style)An ogee shape. stretch: controls the stretch of the ogee curve resolution: step size for generating points (default: 0.1) style: optional style map (default: {:stroke (p-color 0) :stroke-weight 1})
Supports multiple arities: (ogee stretch) - uses default resolution (0.1) and default style (ogee stretch resolution) - if second arg is a number, it's resolution (ogee stretch style) - if second arg is a map, it's style (ogee stretch resolution style) - all parameters
An ogee shape.
stretch: controls the stretch of the ogee curve
resolution: step size for generating points (default: 0.1)
style: optional style map (default: {:stroke (p-color 0) :stroke-weight 1})
Supports multiple arities:
(ogee stretch) - uses default resolution (0.1) and default style
(ogee stretch resolution) - if second arg is a number, it's resolution
(ogee stretch style) - if second arg is a map, it's style
(ogee stretch resolution style) - all parameters(pixel n pixels palette)Create an n x n pixel-art grid from a flat vector of numbers. 0 = empty, positive numbers map to palette entries.
Example: (pixel 2 [0 0 1 1] palette) The palette can be a map keyed by number, or a vector/sequence indexed by (value-1).
Create an n x n pixel-art grid from a flat vector of numbers. 0 = empty, positive numbers map to palette entries. Example: (pixel 2 [0 0 1 1] palette) The palette can be a map keyed by number, or a vector/sequence indexed by (value-1).
(spiral nopoints dr-per-cycle num-cycles)(spiral nopoints dr-per-cycle num-cycles style)(spiral nopoints dr-per-cycle num-cycles r a)(spiral nopoints dr-per-cycle num-cycles r a style)Creates a spiral shape. nopoints: number of points per full cycle (like poly, nangle, star) dr-per-cycle: how much the radius increases over one full cycle num-cycles: number of full cycles to draw
The parameters are independent:
Supports multiple arities: (spiral nopoints dr-per-cycle num-cycles) - starts at r=0, a=0, default style (spiral nopoints dr-per-cycle num-cycles style) - starts at r=0, a=0 (spiral nopoints dr-per-cycle num-cycles r a) - explicit start position, default style (spiral nopoints dr-per-cycle num-cycles r a style) - all parameters
Creates a spiral shape. nopoints: number of points per full cycle (like poly, nangle, star) dr-per-cycle: how much the radius increases over one full cycle num-cycles: number of full cycles to draw The parameters are independent: - Resolution: nopoints controls how smooth the spiral is - Tightness: dr-per-cycle controls how tightly the spiral coils (independent of resolution) - Length: num-cycles controls how many full rotations (independent of resolution) Supports multiple arities: (spiral nopoints dr-per-cycle num-cycles) - starts at r=0, a=0, default style (spiral nopoints dr-per-cycle num-cycles style) - starts at r=0, a=0 (spiral nopoints dr-per-cycle num-cycles r a) - explicit start position, default style (spiral nopoints dr-per-cycle num-cycles r a style) - all parameters
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |