(build-serpentine-path points amplitude center-x)Generate an SVG path string for a serpentine timeline track.
points — vector of {:y number :side "left"|"right"} maps representing the vertical center of each entry amplitude — horizontal distance the curve swings from center (pixels) center-x — horizontal center of the track (pixels)
Returns an SVG path d-attribute string using cubic Bezier curves.
Generate an SVG path string for a serpentine timeline track.
points — vector of {:y number :side "left"|"right"} maps
representing the vertical center of each entry
amplitude — horizontal distance the curve swings from center (pixels)
center-x — horizontal center of the track (pixels)
Returns an SVG path d-attribute string using cubic Bezier curves.(compute-entry-progress entry-top entry-height trigger-y)Compute how far an entry has moved through the viewport. 0 = entry bottom just reached trigger line, 1 = entry top passed it.
Compute how far an entry has moved through the viewport. 0 = entry bottom just reached trigger line, 1 = entry top passed it.
(compute-overall-progress container-top container-height viewport-height)Compute scroll progress [0,1] for the entire timeline container. 0 = container just entered at the bottom, 1 = about to leave at the top.
Compute scroll progress [0,1] for the entire timeline container. 0 = container just entered at the bottom, 1 = about to leave at the top.
(entry-side layout index)Return the data-side string to assign to a child entry. layout — the component's resolved layout string index — the child's 0-based index
"alternating" → even index → "left", odd index → "right" "left" → always "right" (entries on the right of the track) "right" → always "left" (entries on the left of the track)
Return the data-side string to assign to a child entry. layout — the component's resolved layout string index — the child's 0-based index "alternating" → even index → "left", odd index → "right" "left" → always "right" (entries on the right of the track) "right" → always "left" (entries on the left of the track)
(find-active-entry entry-rects trigger-y)Given a vector of {:top :bottom} rects and a trigger-y position (pixels from the top of the viewport), return the index of the active entry or -1.
An entry is active when it spans the trigger line (top <= trigger-y < bottom). If no entry spans it, the last entry whose top is above the trigger line wins.
Given a vector of {:top :bottom} rects and a trigger-y position (pixels
from the top of the viewport), return the index of the active entry or -1.
An entry is active when it spans the trigger line (top <= trigger-y < bottom).
If no entry spans it, the last entry whose top is above the trigger line wins.(normalize {:keys [layout-raw track-raw threshold-raw no-progress-attr
disabled-attr label-raw marker-raw autoplay-attr
autoplay-speed-raw autoplay-loop-attr
autoplay-indicator-attr]})Normalise raw attribute inputs into a stable view-model map.
Input keys: :layout-raw string | nil :track-raw string | nil :threshold-raw string | nil :no-progress-attr string | nil (hasAttribute) :disabled-attr string | nil (hasAttribute) :label-raw string | nil :marker-raw string | nil :autoplay-attr string | nil (hasAttribute) :autoplay-speed-raw string | nil :autoplay-loop-attr string | nil (hasAttribute) :autoplay-indicator-attr string | nil (hasAttribute)
Output keys: :layout string — "alternating" | "left" | "right" :track string — "straight" | "curved" :threshold number — [0,1] :no-progress? boolean :disabled? boolean :label string :marker string — "dot" | "ring" | "none" :autoplay? boolean :autoplay-speed number — [1,1000] :autoplay-loop? boolean :autoplay-indicator? boolean
Normalise raw attribute inputs into a stable view-model map. Input keys: :layout-raw string | nil :track-raw string | nil :threshold-raw string | nil :no-progress-attr string | nil (hasAttribute) :disabled-attr string | nil (hasAttribute) :label-raw string | nil :marker-raw string | nil :autoplay-attr string | nil (hasAttribute) :autoplay-speed-raw string | nil :autoplay-loop-attr string | nil (hasAttribute) :autoplay-indicator-attr string | nil (hasAttribute) Output keys: :layout string — "alternating" | "left" | "right" :track string — "straight" | "curved" :threshold number — [0,1] :no-progress? boolean :disabled? boolean :label string :marker string — "dot" | "ring" | "none" :autoplay? boolean :autoplay-speed number — [1,1000] :autoplay-loop? boolean :autoplay-indicator? boolean
(parse-autoplay-speed s)Parse autoplay-speed attribute to a positive number clamped to [1,1000]. Default 50 px/s.
Parse autoplay-speed attribute to a positive number clamped to [1,1000]. Default 50 px/s.
(parse-bool-attr s)Standard HTML boolean attribute: present (non-nil) = true, absent (nil) = false.
Standard HTML boolean attribute: present (non-nil) = true, absent (nil) = false.
(parse-layout s)Normalise layout attribute to "alternating", "left", or "right". Unknown / nil values fall back to "alternating".
Normalise layout attribute to "alternating", "left", or "right". Unknown / nil values fall back to "alternating".
(parse-marker s)Normalise marker attribute to "dot", "ring", or "none". Unknown / nil values fall back to "dot".
Normalise marker attribute to "dot", "ring", or "none". Unknown / nil values fall back to "dot".
(parse-threshold s)Parse threshold attribute to a float clamped to [0,1]. Default 0.5.
Parse threshold attribute to a float clamped to [0,1]. Default 0.5.
(parse-track s)Normalise track attribute to "straight" or "curved". Unknown / nil values fall back to "straight".
Normalise track attribute to "straight" or "curved". Unknown / nil values fall back to "straight".
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 |