Skip to main content
Introducing packages.sweber.dev
Documentation menuAPI

API

Every export of @sweberdev/sigmoid and @sweberdev/sigmoid-react.

@sweberdev/sigmoid

ExportSignature
reveal(targets, { keyframes?, range?, stagger?, shift?, axis?, subject?, easing?, reducedMotion?, fallback? }) => Controller
track(targets, (progress, element) => void, { range?, axis? }) => Controller
story(targets, { steps, onStep?, range?, axis? }) => Controller: sets data-sigmoid-step and --sigmoid-progress
parallax(targets, { distance?, easing?, reducedMotion?, fallback? }) => Controller
scrub(targets, keyframes, { source?, axis?, range?, easing?, reducedMotion?, fallback? }) => Controller
splitText(target, { by?: "words" | "chars" }) => { elements, parent, revert() }
progress(targets, { source?, axis? }) => Controller
init(root = document, { force? }) => stop(): starts the fallback for data-sigmoid, and linked animations (data-sigmoid-follow) in every browser
refresh() => void: measures every fallback element again on the next frame. Needed only after moving elements without resizing anything
supportsScrollTimeline() => boolean
prefersReducedMotion() => boolean
presetsthe keyframes behind the preset names
Axis"block" | "inline"
parseRange, rangeBounds, viewProgressthe view-timeline maths of the fallback

targets is an Element, a selector, an iterable of elements, null or undefined. reducedMotion is "skip" (default) or "allow".

@sweberdev/sigmoid/easing

Also exported from the main entry.

ExportSignature
spring({ duration?, bounce?, stiffness?, damping?, mass?, velocity? }) => Easing
logistic(steepness = 10) => Easing
bezier(x1, y1, x2, y2) => Easing
easing(fn, css?, duration?) => Easing
toLinear(fn, { samples?, tolerance? }) => string
easeout, inOut, standard, sigmoid, smooth, bouncy, wobbly, linear
cssVariables(easings = ease, prefix = "--sigmoid-ease-") => string
interface Easing {
  (t: number): number;
  readonly css: string;
  readonly duration?: number; // ms, springs only
}

@sweberdev/sigmoid/sigmoid.css

data-sigmoid presets, --sigmoid-* custom properties and the --sigmoid-ease-* variables. See CSS only.

@sweberdev/sigmoid/tailwind.css

A Tailwind CSS v4 @theme with --ease-standard, --ease-sigmoid, --ease-smooth, --ease-bouncy and --ease-wobbly. See Easing.

@sweberdev/sigmoid-svelte

Actions, imported by their plain names: use:reveal, use:parallax, use:track, use:story.

ActionParameter
reveala preset name or { preset?, keyframes?, range?, easing?, shift?, stagger?, axis?, subject?, reducedMotion? }
parallaxa distance in pixels or ParallaxOptions
track{ onProgress(progress), range?, axis? }
story{ steps, onStep?(step), range?, axis? }

@sweberdev/sigmoid-react

ExportProps / signature
Revealas?, preset?, range?, shift?, easing?, reducedMotion? and the props of the element
Parallaxas?, distance?, reducedMotion?
ScrollProgresssource?: RefObject<Element> and div props
useReveal(ref, RevealOptions)
useParallax(ref, ParallaxOptions)
useScrub(ref, keyframes, ScrubOptions)
useScrollProgress(ref, { range?, axis? }) => number
useStory(ref, { steps, range?, axis? }) => { step }
useReducedMotion() => boolean

@sweberdev/sigmoid-vue

ExportSignature
vRevealdirective, value is a preset name or { preset?, keyframes?, range?, easing?, shift?, stagger?, reducedMotion? }
vParallaxdirective, value is a distance in pixels or ParallaxOptions
SigmoidPluginapp.use(SigmoidPlugin) registers v-reveal and v-parallax
useReveal(ref, RevealOptions)
useParallax(ref, ParallaxOptions)
useScrub(ref, keyframes, ScrubOptions)
useScrollProgress(ref, { range?, axis? }) => Ref<number>
useStory(ref, { steps, range?, axis? }) => { step: Ref<number> }
useReducedMotion() => Ref<boolean>