(compute-fade-opacity progress fade-range)Compute opacity for a child with data-opacity="fade". fade-range is a fraction of the viewport (e.g. 0.2 for 20%). Returns 1.0 when in the middle, fades to 0.0 at edges.
Compute opacity for a child with data-opacity="fade". fade-range is a fraction of the viewport (e.g. 0.2 for 20%). Returns 1.0 when in the middle, fades to 0.0 at edges.
(compute-parallax-offset progress speed viewport-size initial-offset)Compute the parallax translation in pixels for a child. progress: scroll progress [0,1] speed: parallax speed factor (1 = normal, 0 = fixed, etc.) viewport-size: viewport dimension in pixels initial-offset: data-offset value in pixels
Compute the parallax translation in pixels for a child. progress: scroll progress [0,1] speed: parallax speed factor (1 = normal, 0 = fixed, etc.) viewport-size: viewport dimension in pixels initial-offset: data-offset value in pixels
(compute-progress element-top element-height viewport-height)Compute scroll progress [0,1] given element rect top, element height, and viewport height. 0 = element just entered at the bottom, 1 = element about to leave at the top.
Compute scroll progress [0,1] given element rect top, element height, and viewport height. 0 = element just entered at the bottom, 1 = element about to leave at the top.
(compute-scale progress scale-min)Compute scale for a child with data-scale="grow". scale-min is the minimum scale (e.g. 0.85). Returns 1.0 when centered (progress=0.5), scale-min at edges.
Compute scale for a child with data-scale="grow". scale-min is the minimum scale (e.g. 0.85). Returns 1.0 when centered (progress=0.5), scale-min at edges.
(normalize {:keys [direction-raw source-raw easing-raw disabled-attr
label-raw]})Normalise raw attribute inputs into a stable view-model map.
Input keys: :direction-raw string | nil :source-raw string | nil :easing-raw string | nil :disabled-attr string | nil (hasAttribute) :label-raw string | nil
Output keys: :direction string — "vertical" | "horizontal" :source string — "document" :easing string — "none" | "smooth" :disabled? boolean :label string
Normalise raw attribute inputs into a stable view-model map. Input keys: :direction-raw string | nil :source-raw string | nil :easing-raw string | nil :disabled-attr string | nil (hasAttribute) :label-raw string | nil Output keys: :direction string — "vertical" | "horizontal" :source string — "document" :easing string — "none" | "smooth" :disabled? boolean :label string
(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-direction s)Normalise direction attribute to "vertical" or "horizontal". Unknown / nil values fall back to "vertical".
Normalise direction attribute to "vertical" or "horizontal". Unknown / nil values fall back to "vertical".
(parse-easing s)Normalise easing attribute to "none" or "smooth". Unknown / nil values fall back to "none".
Normalise easing attribute to "none" or "smooth". Unknown / nil values fall back to "none".
(parse-offset s)Parse a data-offset string to a float. Default 0.
Parse a data-offset string to a float. Default 0.
(parse-source s)Normalise source attribute to "document". Unknown / nil values fall back to "document".
Normalise source attribute to "document". Unknown / nil values fall back to "document".
(parse-speed s)Parse a data-speed string to a float. Default 1.0.
Parse a data-speed string to a float. Default 1.0.
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 |