(derive-state {:keys [progress-raw variant-raw color-raw bloom-attr density-raw
seed-raw label-raw]})Normalise raw attribute inputs into a stable view-model map.
Input keys: :progress-raw string | nil :variant-raw string | nil :color-raw string | nil :bloom-attr string | nil (nil when attribute absent) :density-raw string | nil :seed-raw string | nil :label-raw string | nil
Output keys: :progress number | nil (nil = indeterminate) :percent number (0-100, 0 if indeterminate) :variant string :color string | nil :bloom? boolean :density string :seed int :label string | nil :indeterminate? boolean :complete? boolean :aria-valuetext string
Normalise raw attribute inputs into a stable view-model map. Input keys: :progress-raw string | nil :variant-raw string | nil :color-raw string | nil :bloom-attr string | nil (nil when attribute absent) :density-raw string | nil :seed-raw string | nil :label-raw string | nil Output keys: :progress number | nil (nil = indeterminate) :percent number (0-100, 0 if indeterminate) :variant string :color string | nil :bloom? boolean :density string :seed int :label string | nil :indeterminate? boolean :complete? boolean :aria-valuetext string
(ease-out-cubic t)Ease-out cubic: 1 - (1-t)^3
Ease-out cubic: 1 - (1-t)^3
(honeycomb-lattice-segments seed density view-w view-h)Generate a honeycomb hexagonal lattice. Growth expands from center outward with random cell reveal order. Returns #js [segments segment-count].
Generate a honeycomb hexagonal lattice. Growth expands from center outward with random cell reveal order. Returns #js [segments segment-count].
(l-system->segments l-string
noise-fn
seed
base-angle
base-length
start-x
start-y)Interpret an L-system string into a flat JS array of segment maps. Each segment is #js {x1 y1 x2 y2 depth index}. Returns #js [segments total-count].
Turtle starts at (start-x, start-y) heading rightward (angle 0). base-angle is the turn angle in radians. base-length is the initial segment length in SVG units.
Interpret an L-system string into a flat JS array of segment maps.
Each segment is #js {x1 y1 x2 y2 depth index}.
Returns #js [segments total-count].
Turtle starts at (start-x, start-y) heading rightward (angle 0).
base-angle is the turn angle in radians.
base-length is the initial segment length in SVG units.(l-system-iterate axiom rules n)Apply L-system rules n times to axiom string. Returns final string.
Apply L-system rules n times to axiom string. Returns final string.
(make-noise-fn seed)Returns a noise function offset by seed for distinct patterns per seed.
Returns a noise function offset by seed for distinct patterns per seed.
(make-rng seed)Create a seeded PRNG state. Returns a mutable JS array [state].
Create a seeded PRNG state. Returns a mutable JS array [state].
(parse-bloom s)Parse bloom attribute. Absent (nil) → true, "false" → false.
Parse bloom attribute. Absent (nil) → true, "false" → false.
(parse-color s)Parse a color attribute. Returns non-empty trimmed string or nil.
Parse a color attribute. Returns non-empty trimmed string or nil.
(parse-density s)Parse density attribute. Returns "sparse", "normal", or "dense".
Parse density attribute. Returns "sparse", "normal", or "dense".
(parse-label s)Parse label attribute. Returns trimmed non-empty string or nil.
Parse label attribute. Returns trimmed non-empty string or nil.
(parse-progress s)Parse progress attribute. Returns nil for indeterminate, or float in [0,100].
Parse progress attribute. Returns nil for indeterminate, or float in [0,100].
(parse-seed s)Parse seed attribute to a positive integer.
Parse seed attribute to a positive integer.
(parse-variant s)Parse variant attribute. Returns "vine" or "honeycomb".
Parse variant attribute. Returns "vine" or "honeycomb".
(rng-next! rng)Advance the PRNG and return a float in [0, 1).
Advance the PRNG and return a float in [0, 1).
(simplex-noise-2d x y)2D simplex noise. Returns value in approximately [-1, 1].
2D simplex noise. Returns value in approximately [-1, 1].
(spring-step current target velocity dt stiffness damping)Single step of damped spring physics. Returns #js [new-position new-velocity]. stiffness ~120, damping ~12 for near-critical damping.
Single step of damped spring physics. Returns #js [new-position new-velocity]. stiffness ~120, damping ~12 for near-critical damping.
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 |