API reference
lib/motion-spring
Import
Section titled “Import”import * as api from "@fungi.computer/caps/lib/motion-spring";Exports
Section titled “Exports”| Kind | Export | Description |
|---|---|---|
| type alias | MotionTiming | Anime.js timing for one tween or segment. |
| type alias | AuthoredSpring | A component’s own spring, as authored for today’s default feel. |
| constant | immediateTiming | Timing for a change that must land at once. |
| function | themedSpring() | Anime.js timing for an authored spring, in the theme’s feel: bounce and settle
time scale with --stipe-motion-bounce and --stipe-motion-spring-duration,
and a stepped theme moves in --stipe-motion-steps discrete steps instead.
Today’s themes reproduce the authored spring exactly. |
| function | themedEase() | Anime.js timing for an authored eased segment: the duration scales with the theme’s tempo, and a stepped theme replaces the curve with steps. |
MotionTimingtype alias
Section titled “MotionTiming”type MotionTiming = Readonly<{ ease: EasingParam; duration: number;}>;Anime.js timing for one tween or segment.
AuthoredSpringtype alias
Section titled “AuthoredSpring”type AuthoredSpring = Readonly<{ bounce: number; duration: number;}>;A component’s own spring, as authored for today’s default feel.
immediateTimingconstant
Section titled “immediateTiming”const immediateTiming: MotionTiming;Timing for a change that must land at once.
themedSpring()function
Section titled “themedSpring()”function themedSpring(motion, authored): MotionTiming;Anime.js timing for an authored spring, in the theme’s feel: bounce and settle
time scale with --stipe-motion-bounce and --stipe-motion-spring-duration,
and a stepped theme moves in --stipe-motion-steps discrete steps instead.
Today’s themes reproduce the authored spring exactly.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
motion |
Motion |
authored |
AuthoredSpring |
Returns
Section titled “Returns”themedEase()function
Section titled “themedEase()”function themedEase(motion, authored): MotionTiming;Anime.js timing for an authored eased segment: the duration scales with the theme’s tempo, and a stepped theme replaces the curve with steps.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
motion |
Motion |
authored |
MotionTiming |