(build-variation-string axes)Build a CSS font-variation-settings string from axis values. axes is #js [wght wdth slnt opsz].
Build a CSS font-variation-settings string from axis values. axes is #js [wght wdth slnt opsz].
(compute-cursor-force distance radius)Compute normalised force (0–1) from cursor distance with quadratic falloff. Returns 0.0 when distance >= radius.
Compute normalised force (0–1) from cursor distance with quadratic falloff. Returns 0.0 when distance >= radius.
(compute-scroll-force scroll-delta)Normalise scroll delta to a 0–1 force value.
Normalise scroll delta to a 0–1 force value.
(derive-state {:keys [text-raw trigger-raw mode-raw per-char-attr mass-raw
tension-raw friction-raw intensity-raw radius-raw
font-family-raw]})Normalise raw attribute inputs into a stable view-model map.
Input keys: :text-raw string | nil :trigger-raw string | nil :mode-raw string | nil :per-char-attr string | nil (nil when absent) :mass-raw string | nil :tension-raw string | nil :friction-raw string | nil :intensity-raw string | nil :radius-raw string | nil :font-family-raw string | nil
Output keys: :text string :trigger string :modes #{string} :per-char? boolean :mass number :tension number :friction number :intensity number :radius number :font-family string | nil
Normalise raw attribute inputs into a stable view-model map.
Input keys:
:text-raw string | nil
:trigger-raw string | nil
:mode-raw string | nil
:per-char-attr string | nil (nil when absent)
:mass-raw string | nil
:tension-raw string | nil
:friction-raw string | nil
:intensity-raw string | nil
:radius-raw string | nil
:font-family-raw string | nil
Output keys:
:text string
:trigger string
:modes #{string}
:per-char? boolean
:mass number
:tension number
:friction number
:intensity number
:radius number
:font-family string | nil(map-force-to-axes force
modes
intensity
wght-min
wght-max
wdth-min
wdth-max
slnt-min
slnt-max
opsz-min
opsz-max)Map a force value (0–1) to font variation axis values based on active modes. Returns #js [wght wdth slnt opsz].
Map a force value (0–1) to font variation axis values based on active modes. Returns #js [wght wdth slnt opsz].
(normalize-font-family s)Normalise font-family attribute. Returns trimmed string or nil.
Normalise font-family attribute. Returns trimmed string or nil.
(normalize-text s)Normalise text attribute. Returns string (possibly empty).
Normalise text attribute. Returns string (possibly empty).
(parse-modes s)Parse space-separated mode tokens. Returns a set of valid mode strings.
Parse space-separated mode tokens. Returns a set of valid mode strings.
(parse-per-char s)Parse per-char boolean attribute. Present (any value) → true, nil → false.
Parse per-char boolean attribute. Present (any value) → true, nil → false.
(parse-trigger s)Parse trigger attribute. Returns "cursor", "scroll", or "both".
Parse trigger attribute. Returns "cursor", "scroll", or "both".
(spring-settled? displacement velocity)Returns true when displacement and velocity are below threshold.
Returns true when displacement and velocity are below threshold.
(spring-step current target velocity dt mass tension friction)Single step of damped spring physics (1D) with mass. Returns #js [new-displacement new-velocity]. Acceleration = (tension * (target - current) - friction * velocity) / mass
Single step of damped spring physics (1D) with mass. Returns #js [new-displacement new-velocity]. Acceleration = (tension * (target - current) - friction * velocity) / mass
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 |