@algorisys/tinyfly 0.64.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +672 -0
- package/bin/tinyfly.mjs +59 -0
- package/lib/addons/adapters.js +756 -0
- package/lib/addons/dom-adapter-ChrbtkLC.js +243 -0
- package/lib/addons/drivers.js +72 -0
- package/lib/addons/export.js +1169 -0
- package/lib/addons/gsap-compat.js +2576 -0
- package/lib/addons/interaction.js +225 -0
- package/lib/addons/smooth-scroll-DaSacemU.js +671 -0
- package/lib/addons/teach.js +215 -0
- package/lib/browser/tinyfly.iife.js +2 -0
- package/lib/browser/tinyfly.js +6372 -0
- package/lib/browser/tinyfly.umd.js +2 -0
- package/lib/cli/tools.js +2325 -0
- package/lib/embed/tinyfly-embed.iife.js +18 -0
- package/lib/embed/tinyfly-embed.js +2316 -0
- package/lib/engine/tinyfly-engine.js +1972 -0
- package/lib/engine/tinyfly-engine.umd.cjs +2 -0
- package/lib/frameworks/react.js +32 -0
- package/lib/frameworks/solid.js +27 -0
- package/lib/frameworks/svelte.js +15 -0
- package/lib/frameworks/vue.js +29 -0
- package/lib/player/tinyfly-player.es.js +2306 -0
- package/lib/player/tinyfly-player.iife.js +2 -0
- package/lib/player/tinyfly-player.umd.js +2 -0
- package/lib/types/adapters/canvas/canvas-adapter.d.ts +238 -0
- package/lib/types/adapters/canvas/index.d.ts +1 -0
- package/lib/types/adapters/dom/dom-adapter.d.ts +50 -0
- package/lib/types/adapters/dom/flip.d.ts +60 -0
- package/lib/types/adapters/dom/index.d.ts +2 -0
- package/lib/types/adapters/filter-utils.d.ts +32 -0
- package/lib/types/adapters/index.d.ts +5 -0
- package/lib/types/adapters/shine-utils.d.ts +26 -0
- package/lib/types/adapters/svg/index.d.ts +1 -0
- package/lib/types/adapters/svg/svg-adapter.d.ts +47 -0
- package/lib/types/adapters/svg-transform-box.d.ts +13 -0
- package/lib/types/adapters/text-content.d.ts +11 -0
- package/lib/types/adapters/webgl/index.d.ts +1 -0
- package/lib/types/adapters/webgl/webgl-adapter.d.ts +69 -0
- package/lib/types/browser/index.d.ts +41 -0
- package/lib/types/compat/gsap/custom-eases.d.ts +28 -0
- package/lib/types/compat/gsap/defaults.d.ts +19 -0
- package/lib/types/compat/gsap/draw-svg-vars.d.ts +36 -0
- package/lib/types/compat/gsap/ease-map.d.ts +51 -0
- package/lib/types/compat/gsap/image-sequence.d.ts +61 -0
- package/lib/types/compat/gsap/index.d.ts +65 -0
- package/lib/types/compat/gsap/inertia-vars.d.ts +39 -0
- package/lib/types/compat/gsap/keyframes-vars.d.ts +8 -0
- package/lib/types/compat/gsap/layout.d.ts +6 -0
- package/lib/types/compat/gsap/live-context.d.ts +87 -0
- package/lib/types/compat/gsap/live-draggable.d.ts +75 -0
- package/lib/types/compat/gsap/live-flip.d.ts +73 -0
- package/lib/types/compat/gsap/live-morph.d.ts +18 -0
- package/lib/types/compat/gsap/live-motion-path.d.ts +33 -0
- package/lib/types/compat/gsap/live-scroll-to.d.ts +52 -0
- package/lib/types/compat/gsap/live-scroll.d.ts +108 -0
- package/lib/types/compat/gsap/live-transition.d.ts +40 -0
- package/lib/types/compat/gsap/live.d.ts +341 -0
- package/lib/types/compat/gsap/morph-vars.d.ts +21 -0
- package/lib/types/compat/gsap/motion-path-vars.d.ts +38 -0
- package/lib/types/compat/gsap/playhead-crossings.d.ts +47 -0
- package/lib/types/compat/gsap/position.d.ts +37 -0
- package/lib/types/compat/gsap/quick-play.d.ts +38 -0
- package/lib/types/compat/gsap/split-text.d.ts +66 -0
- package/lib/types/compat/gsap/spring-vars.d.ts +34 -0
- package/lib/types/compat/gsap/stage.d.ts +182 -0
- package/lib/types/compat/gsap/stagger-grid.d.ts +30 -0
- package/lib/types/compat/gsap/text-vars.d.ts +39 -0
- package/lib/types/compat/gsap/timeline.d.ts +161 -0
- package/lib/types/compat/gsap/utils.d.ts +60 -0
- package/lib/types/compat/gsap/vars.d.ts +79 -0
- package/lib/types/drivers/index.d.ts +8 -0
- package/lib/types/drivers/scroll-driver.d.ts +218 -0
- package/lib/types/drivers/scroll-markers.d.ts +41 -0
- package/lib/types/drivers/scroll-math.d.ts +87 -0
- package/lib/types/drivers/scroll-pin.d.ts +45 -0
- package/lib/types/drivers/scroll-snap.d.ts +47 -0
- package/lib/types/drivers/smooth-scroll.d.ts +118 -0
- package/lib/types/drivers/types.d.ts +23 -0
- package/lib/types/drivers/visibility-driver.d.ts +56 -0
- package/lib/types/embed/controls.d.ts +46 -0
- package/lib/types/embed/index.d.ts +17 -0
- package/lib/types/embed/mount.d.ts +41 -0
- package/lib/types/embed/tools.d.ts +33 -0
- package/lib/types/engine/authoring/custom-ease.d.ts +49 -0
- package/lib/types/engine/authoring/index.d.ts +3 -0
- package/lib/types/engine/authoring/random.d.ts +38 -0
- package/lib/types/engine/authoring/resolve-values.d.ts +57 -0
- package/lib/types/engine/core/bake.d.ts +66 -0
- package/lib/types/engine/core/clock.d.ts +44 -0
- package/lib/types/engine/core/index.d.ts +8 -0
- package/lib/types/engine/core/inertia.d.ts +30 -0
- package/lib/types/engine/core/playhead-crossings.d.ts +47 -0
- package/lib/types/engine/core/spring.d.ts +132 -0
- package/lib/types/engine/core/stagger.d.ts +40 -0
- package/lib/types/engine/core/timeline.d.ts +203 -0
- package/lib/types/engine/core/track.d.ts +90 -0
- package/lib/types/engine/export/byte-writer.d.ts +36 -0
- package/lib/types/engine/export/css.d.ts +31 -0
- package/lib/types/engine/export/gif-decode.test-helper.d.ts +24 -0
- package/lib/types/engine/export/gif.d.ts +134 -0
- package/lib/types/engine/export/index.d.ts +9 -0
- package/lib/types/engine/export/lottie.d.ts +104 -0
- package/lib/types/engine/export/mp4.d.ts +64 -0
- package/lib/types/engine/export/quantize.d.ts +56 -0
- package/lib/types/engine/export/sprite-sheet.d.ts +46 -0
- package/lib/types/engine/export/video.d.ts +99 -0
- package/lib/types/engine/export/webp.d.ts +82 -0
- package/lib/types/engine/index.d.ts +7 -0
- package/lib/types/engine/interpolation/easing.d.ts +65 -0
- package/lib/types/engine/interpolation/index.d.ts +2 -0
- package/lib/types/engine/interpolation/interpolators.d.ts +25 -0
- package/lib/types/engine/path/index.d.ts +11 -0
- package/lib/types/engine/path/motion-path.d.ts +24 -0
- package/lib/types/engine/path/path-builders.d.ts +38 -0
- package/lib/types/engine/path/path-morph.d.ts +47 -0
- package/lib/types/engine/path/path-utils.d.ts +73 -0
- package/lib/types/engine/serialization/index.d.ts +1 -0
- package/lib/types/engine/serialization/json.d.ts +30 -0
- package/lib/types/engine/text/index.d.ts +2 -0
- package/lib/types/engine/text/text-value.d.ts +16 -0
- package/lib/types/engine/types.d.ts +401 -0
- package/lib/types/frameworks/react.d.ts +35 -0
- package/lib/types/frameworks/solid.d.ts +16 -0
- package/lib/types/frameworks/svelte.d.ts +19 -0
- package/lib/types/frameworks/vue.d.ts +27 -0
- package/lib/types/interaction/draggable.d.ts +133 -0
- package/lib/types/interaction/index.d.ts +3 -0
- package/lib/types/interaction/observer.d.ts +80 -0
- package/lib/types/interaction/snap.d.ts +30 -0
- package/lib/types/player/index.d.ts +7 -0
- package/lib/types/player/media-sync.d.ts +60 -0
- package/lib/types/player/player.d.ts +238 -0
- package/lib/types/player/sequence-types.d.ts +68 -0
- package/lib/types/player/sequencer.d.ts +91 -0
- package/lib/types/teach/diagrams.d.ts +137 -0
- package/lib/types/teach/index.d.ts +11 -0
- package/lib/types/teach/lesson.d.ts +55 -0
- package/package.json +170 -0
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { TinyflyPlayer } from '../player/player';
|
|
2
|
+
/**
|
|
3
|
+
* Controls for a teaching animation: play / pause, step back and forward
|
|
4
|
+
* (through markers), restart, a scrub bar, speed, the current step's caption, and
|
|
5
|
+
* a question to answer before the next step is revealed.
|
|
6
|
+
*
|
|
7
|
+
* Kept out of the player and engine builds. Styled only through CSS custom
|
|
8
|
+
* properties on the bar (`--tf-ctl-fg`, `--tf-ctl-bg`, `--tf-ctl-accent`,
|
|
9
|
+
* `--tf-ctl-radius`, `--tf-ctl-font`); every class is prefixed `tf-ctl`, so no
|
|
10
|
+
* page styles are touched. All visible text comes from `labels`, so each page
|
|
11
|
+
* can speak its own language.
|
|
12
|
+
*
|
|
13
|
+
* Keys work while focus is inside the figure, so several figures on one page
|
|
14
|
+
* never react to the same key: Space plays or pauses, ← and → step, Home restarts.
|
|
15
|
+
*/
|
|
16
|
+
export interface ControlLabels {
|
|
17
|
+
play: string;
|
|
18
|
+
pause: string;
|
|
19
|
+
prev: string;
|
|
20
|
+
next: string;
|
|
21
|
+
restart: string;
|
|
22
|
+
scrub: string;
|
|
23
|
+
speed: string;
|
|
24
|
+
reveal: string;
|
|
25
|
+
/** Announced before the step number, e.g. "Step" → "Step 2 of 5" */
|
|
26
|
+
step: string;
|
|
27
|
+
of: string;
|
|
28
|
+
}
|
|
29
|
+
export declare const DEFAULT_LABELS: ControlLabels;
|
|
30
|
+
export interface ControlsOptions {
|
|
31
|
+
/** Visible and announced text; missing entries use English */
|
|
32
|
+
labels?: Partial<ControlLabels>;
|
|
33
|
+
/** Speed choices (default [0.5, 1, 2]); an empty list hides the speed control */
|
|
34
|
+
speeds?: number[];
|
|
35
|
+
/** Show the current step's caption under the bar (default true) */
|
|
36
|
+
captions?: boolean;
|
|
37
|
+
/** The element keys are listened on (default: the player's container) */
|
|
38
|
+
keyboardScope?: HTMLElement;
|
|
39
|
+
/** Where to put the bar (default: right after the player's container) */
|
|
40
|
+
mount?: HTMLElement;
|
|
41
|
+
}
|
|
42
|
+
export interface Controls {
|
|
43
|
+
readonly element: HTMLElement;
|
|
44
|
+
destroy(): void;
|
|
45
|
+
}
|
|
46
|
+
export declare function createControls(player: TinyflyPlayer, container: HTMLElement, options?: ControlsOptions): Controls;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @algorisys/tinyfly/embed — teaching embeds: the player, step controls and declarative
|
|
3
|
+
* auto-mounting in one bundle, plus build-time `validateEmbed` and `renderFrame`.
|
|
4
|
+
*
|
|
5
|
+
* <script src="…/tinyfly-embed.iife.js" data-tinyfly-auto></script>
|
|
6
|
+
*
|
|
7
|
+
* With `data-tinyfly-auto`, every `[data-tinyfly-embed]` figure mounts when the
|
|
8
|
+
* page is ready. Otherwise call `tinyfly.mountAll()`.
|
|
9
|
+
*/
|
|
10
|
+
export { TinyflyPlayer, play, create } from '../player/player';
|
|
11
|
+
export type { PlayerOptions } from '../player/player';
|
|
12
|
+
export { createControls, DEFAULT_LABELS } from './controls';
|
|
13
|
+
export type { Controls, ControlsOptions, ControlLabels } from './controls';
|
|
14
|
+
export { mount, mountAll, unmount } from './mount';
|
|
15
|
+
export type { MountedEmbed, MountOptions } from './mount';
|
|
16
|
+
export { validateEmbed, renderFrame, targetNamesIn } from './tools';
|
|
17
|
+
export type { EmbedProblem, FrameAt } from './tools';
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { TinyflyPlayer, type PlayerOptions } from '../player/player';
|
|
2
|
+
import { type Controls, type ControlsOptions } from './controls';
|
|
3
|
+
/**
|
|
4
|
+
* Declarative embeds, for pages where inline init scripts get deferred,
|
|
5
|
+
* combined or stripped (CMS optimisation plugins): paste markup, load one
|
|
6
|
+
* script, and every figure mounts itself.
|
|
7
|
+
*
|
|
8
|
+
* <figure data-tinyfly-embed data-options='{"stepMode": true}' data-alt="How a slice grows">
|
|
9
|
+
* <svg viewBox="0 0 720 200">…<rect data-tinyfly="cell-0" …/>…</svg>
|
|
10
|
+
* <script type="application/json" data-tinyfly-timeline>{ …timeline JSON… }</script>
|
|
11
|
+
* <figcaption>Appending to a full slice allocates a new array.</figcaption>
|
|
12
|
+
* </figure>
|
|
13
|
+
*
|
|
14
|
+
* <script src="…/tinyfly-embed.iife.js" data-tinyfly-auto></script>
|
|
15
|
+
*
|
|
16
|
+
* Or call `tinyfly.mountAll()` yourself. The timeline may also come from a URL
|
|
17
|
+
* (`data-src="slice.json"`). Translated captions can sit beside it in a
|
|
18
|
+
* `<script type="application/json" data-tinyfly-captions>`. `data-controls="false"`
|
|
19
|
+
* leaves the controls out, and `data-labels` passes control labels as JSON.
|
|
20
|
+
*
|
|
21
|
+
* Embeds default to `playWhenVisible: true`. Each SVG without a role becomes a
|
|
22
|
+
* labelled image (`role="img"`, named by `data-alt` or the figcaption), and the
|
|
23
|
+
* step captions are announced as they change.
|
|
24
|
+
*/
|
|
25
|
+
export interface MountedEmbed {
|
|
26
|
+
element: HTMLElement;
|
|
27
|
+
player: TinyflyPlayer;
|
|
28
|
+
controls?: Controls;
|
|
29
|
+
}
|
|
30
|
+
export interface MountOptions {
|
|
31
|
+
/** Player options applied to every embed (an embed's `data-options` win) */
|
|
32
|
+
player?: PlayerOptions;
|
|
33
|
+
/** Controls options applied to every embed (`data-labels` win for labels) */
|
|
34
|
+
controls?: ControlsOptions;
|
|
35
|
+
}
|
|
36
|
+
/** Mount one embed (idempotent). */
|
|
37
|
+
export declare function mount(element: HTMLElement, options?: MountOptions): Promise<MountedEmbed | undefined>;
|
|
38
|
+
/** Mount every `[data-tinyfly-embed]` under `root` that is not mounted yet. */
|
|
39
|
+
export declare function mountAll(root?: ParentNode, options?: MountOptions): Promise<MountedEmbed[]>;
|
|
40
|
+
/** Stop and remove an embed's player and controls. */
|
|
41
|
+
export declare function unmount(element: HTMLElement): void;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { type TimelineDefinition } from '../engine';
|
|
2
|
+
/**
|
|
3
|
+
* Build-time tools for embedded animations, with no DOM: validating a timeline
|
|
4
|
+
* against its markup, and rendering a frame into static markup for places that
|
|
5
|
+
* never run JavaScript (RSS, email, print, previews, Open Graph images).
|
|
6
|
+
*
|
|
7
|
+
* Both are used by the `tinyfly` command:
|
|
8
|
+
*
|
|
9
|
+
* npx @algorisys/tinyfly validate slice.json --markup slice.svg
|
|
10
|
+
* npx @algorisys/tinyfly render slice.json slice.svg --at end > slice-final.svg
|
|
11
|
+
*/
|
|
12
|
+
export interface EmbedProblem {
|
|
13
|
+
level: 'error' | 'warning';
|
|
14
|
+
message: string;
|
|
15
|
+
}
|
|
16
|
+
/** The `data-tinyfly` names in a piece of markup. */
|
|
17
|
+
export declare function targetNamesIn(markup: string): string[];
|
|
18
|
+
/**
|
|
19
|
+
* Problems that would make an embedded animation wrong or confusing: tracks aimed
|
|
20
|
+
* at elements the markup lacks, markers out of order or outside the animation,
|
|
21
|
+
* keyframes past an explicit duration, captions for markers that do not exist.
|
|
22
|
+
*/
|
|
23
|
+
export declare function validateEmbed(definition: TimelineDefinition, options?: {
|
|
24
|
+
markup?: string;
|
|
25
|
+
}): EmbedProblem[];
|
|
26
|
+
/** Which frame to render: the start, the end, a time in ms, or a marker id. */
|
|
27
|
+
export type FrameAt = 'start' | 'end' | number | string;
|
|
28
|
+
/**
|
|
29
|
+
* The markup with the animation's state at one moment written into each
|
|
30
|
+
* animated element's `style` (and text), so it shows that frame with no script.
|
|
31
|
+
* Styles are appended to any the element already has, so they win.
|
|
32
|
+
*/
|
|
33
|
+
export declare function renderFrame(markup: string, definition: TimelineDefinition, at?: FrameAt): string;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { CubicBezierPoints, EasingFunction } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Custom ease curves, built at authoring time.
|
|
4
|
+
*
|
|
5
|
+
* An ease maps progress in time (x, 0..1) to progress in value (y). These build
|
|
6
|
+
* one from what designers hand over: a curve drawn as SVG path data, bezier
|
|
7
|
+
* points, or a generated bounce or wiggle. Everything here is a pure function of
|
|
8
|
+
* its input, and the result is either an exact cubic-bezier (serializable as is)
|
|
9
|
+
* or a function a timeline samples into keyframes (see `bakeEasing`).
|
|
10
|
+
*/
|
|
11
|
+
export interface CustomEaseResult {
|
|
12
|
+
/** The curve as a function of progress */
|
|
13
|
+
fn: EasingFunction;
|
|
14
|
+
/** Set when the curve is exactly one cubic-bezier, which serializes without sampling */
|
|
15
|
+
bezier?: CubicBezierPoints;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* A custom ease from SVG path data or bezier control points.
|
|
19
|
+
*
|
|
20
|
+
* Path data may be in any coordinate space and either y direction: x is scaled
|
|
21
|
+
* so the path runs from 0 to 1, and y so it starts at 0 and ends at 1. So a curve
|
|
22
|
+
* exported from a design tool (y growing downward, a 500-wide artboard) and one
|
|
23
|
+
* written in unit space give the same ease. Along x the path must not double
|
|
24
|
+
* back; along y it may overshoot and undershoot freely.
|
|
25
|
+
*/
|
|
26
|
+
export declare function customEase(definition: string | CubicBezierPoints): CustomEaseResult;
|
|
27
|
+
export interface CustomBounceOptions {
|
|
28
|
+
/** 0..1: how lively; higher bounces higher and more often (default 0.7) */
|
|
29
|
+
strength?: number;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* A ball dropped onto the end value: it lands, bounces back up by less each
|
|
33
|
+
* time, and settles. Each rebound keeps `strength × 0.7 + 0.1` of the height, and
|
|
34
|
+
* the bounces are timed as a real ball's would be, so the curve reads as gravity.
|
|
35
|
+
*/
|
|
36
|
+
export declare function customBounce(options?: CustomBounceOptions): EasingFunction;
|
|
37
|
+
export type WiggleType = 'easeOut' | 'easeInOut' | 'uniform';
|
|
38
|
+
export interface CustomWiggleOptions {
|
|
39
|
+
/** Full oscillations over the tween (default 10) */
|
|
40
|
+
wiggles?: number;
|
|
41
|
+
/** How the swing's size changes: dying away (default), rising then falling, or constant */
|
|
42
|
+
type?: WiggleType;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* An oscillation that starts and ends at 0, swinging between -1 and 1. Used as
|
|
46
|
+
* an ease it wiggles a value around its start: `rotate: 20` with a wiggle ease
|
|
47
|
+
* swings ±20 degrees and comes back. Unlike other eases it ends where it began.
|
|
48
|
+
*/
|
|
49
|
+
export declare function customWiggle(options?: CustomWiggleOptions): EasingFunction;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Seeded pseudo-random numbers.
|
|
3
|
+
*
|
|
4
|
+
* GSAP's `random()` is evaluated at runtime, which we cannot do: a value that
|
|
5
|
+
* differs between runs is neither deterministic nor serializable. Instead we
|
|
6
|
+
* resolve random values once at authoring time from a recorded seed, store the
|
|
7
|
+
* concrete numbers in the JSON, and keep the seed so the same animation can be
|
|
8
|
+
* regenerated identically.
|
|
9
|
+
*
|
|
10
|
+
* This is a small xorshift generator rather than a dependency — it is a dozen
|
|
11
|
+
* lines and we only need repeatability, not statistical quality.
|
|
12
|
+
*/
|
|
13
|
+
/** Deterministic 0..1 generator. */
|
|
14
|
+
export interface RandomSource {
|
|
15
|
+
/** Next value in [0, 1) */
|
|
16
|
+
next(): number;
|
|
17
|
+
/** The seed this source was created with */
|
|
18
|
+
readonly seed: number;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Turn any string into a 32-bit seed, so a project name or track id can be used
|
|
22
|
+
* where a number is expected.
|
|
23
|
+
*/
|
|
24
|
+
export declare function hashSeed(input: string): number;
|
|
25
|
+
/**
|
|
26
|
+
* Create a seeded generator. The same seed always yields the same sequence,
|
|
27
|
+
* on any platform.
|
|
28
|
+
*/
|
|
29
|
+
export declare function createRandom(seed: number): RandomSource;
|
|
30
|
+
/** A value in [min, max), drawn from `source`. */
|
|
31
|
+
export declare function randomBetween(source: RandomSource, min: number, max: number): number;
|
|
32
|
+
/**
|
|
33
|
+
* A value in [min, max] snapped to a multiple of `step`, measured from `min`.
|
|
34
|
+
* Mirrors GSAP's third `random()` argument.
|
|
35
|
+
*/
|
|
36
|
+
export declare function randomSnapped(source: RandomSource, min: number, max: number, step: number): number;
|
|
37
|
+
/** One item from `items`, drawn from `source`. */
|
|
38
|
+
export declare function randomChoice<T>(source: RandomSource, items: readonly T[]): T | undefined;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { AnimatableValue } from '../types';
|
|
2
|
+
import { type RandomSource } from './random';
|
|
3
|
+
/**
|
|
4
|
+
* Compile-time resolution of relative and random property values.
|
|
5
|
+
*
|
|
6
|
+
* GSAP resolves `"+=100"` and `random(-50, 50)` when a tween runs. We resolve
|
|
7
|
+
* them when the timeline is *built*, and store the concrete number. Two rules
|
|
8
|
+
* fall out of the project's principles:
|
|
9
|
+
*
|
|
10
|
+
* - Determinism: a timeline must replay identically, so nothing may be
|
|
11
|
+
* re-rolled per run or per loop (GSAP's `repeatRefresh` has no equivalent).
|
|
12
|
+
* - JSON-first: what lands in the file is a plain number, not an expression,
|
|
13
|
+
* so any player can read it without an expression evaluator.
|
|
14
|
+
*
|
|
15
|
+
* The seed is kept alongside so regenerating the same animation reproduces the
|
|
16
|
+
* same "random" values.
|
|
17
|
+
*/
|
|
18
|
+
/** A value that still needs resolving: a number, or an expression string. */
|
|
19
|
+
export type UnresolvedValue = AnimatableValue | string;
|
|
20
|
+
export interface ResolveContext {
|
|
21
|
+
/**
|
|
22
|
+
* The value this property currently holds — what a relative expression is
|
|
23
|
+
* measured against. Defaults to 0.
|
|
24
|
+
*/
|
|
25
|
+
base?: number;
|
|
26
|
+
/** Source for random expressions. Required only if random values are used. */
|
|
27
|
+
random?: RandomSource;
|
|
28
|
+
}
|
|
29
|
+
/** Whether a value needs resolving at all. */
|
|
30
|
+
export declare function isUnresolved(value: UnresolvedValue): value is string;
|
|
31
|
+
/**
|
|
32
|
+
* Resolve one value to a concrete number.
|
|
33
|
+
*
|
|
34
|
+
* Non-expression values pass through untouched, so this is safe to run over
|
|
35
|
+
* every keyframe regardless of what it holds (colours, paths, arrays).
|
|
36
|
+
*/
|
|
37
|
+
export declare function resolveValue(value: UnresolvedValue, context?: ResolveContext): AnimatableValue;
|
|
38
|
+
/**
|
|
39
|
+
* Resolve a whole keyframe sequence for one property, threading each resolved
|
|
40
|
+
* value forward as the base for the next.
|
|
41
|
+
*
|
|
42
|
+
* This is what makes a chain like `['+=100', '+=100']` mean "200 by the end"
|
|
43
|
+
* rather than "100 twice".
|
|
44
|
+
*/
|
|
45
|
+
export declare function resolveSequence(values: UnresolvedValue[], startValue?: number, random?: RandomSource): AnimatableValue[];
|
|
46
|
+
/**
|
|
47
|
+
* A resolver bound to one seed. Create it once per authoring session so every
|
|
48
|
+
* random value in a timeline comes from the same reproducible sequence.
|
|
49
|
+
*/
|
|
50
|
+
export declare class ValueResolver {
|
|
51
|
+
readonly random: RandomSource;
|
|
52
|
+
constructor(seed: number);
|
|
53
|
+
/** The seed, to be stored alongside the timeline so this can be reproduced. */
|
|
54
|
+
get seed(): number;
|
|
55
|
+
resolve(value: UnresolvedValue, base?: number): AnimatableValue;
|
|
56
|
+
resolveSequence(values: UnresolvedValue[], startValue?: number): AnimatableValue[];
|
|
57
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import type { AnyTrack, Track, Keyframe, EasingType, KeyframedTrack } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Baking: turning a computed animation into plain keyframes.
|
|
4
|
+
*
|
|
5
|
+
* Two callers need this. Export formats (CSS, Lottie, GIF) can only express
|
|
6
|
+
* keyframes, so a spring track has to be sampled before it can leave the
|
|
7
|
+
* engine. And the GSAP compat layer offers eases we have no closed form for
|
|
8
|
+
* (elastic, bounce, steps), which are handled the same way.
|
|
9
|
+
*
|
|
10
|
+
* Baking is lossy in file size, not in fidelity: sampling a deterministic
|
|
11
|
+
* simulation at a fixed rate always produces the same keyframes.
|
|
12
|
+
*/
|
|
13
|
+
/** Default sampling interval, in milliseconds (60fps). */
|
|
14
|
+
export declare const DEFAULT_BAKE_INTERVAL_MS: number;
|
|
15
|
+
export interface BakeOptions {
|
|
16
|
+
/** Milliseconds between sampled keyframes (default: one 60fps frame) */
|
|
17
|
+
intervalMs?: number;
|
|
18
|
+
/**
|
|
19
|
+
* Drop a sample when it sits within this distance of the straight line
|
|
20
|
+
* between its neighbours. Keeps baked output small without visible change.
|
|
21
|
+
* Set to 0 to keep every sample.
|
|
22
|
+
*/
|
|
23
|
+
tolerance?: number;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Sample a spring track into an ordinary keyframe track.
|
|
27
|
+
*
|
|
28
|
+
* The result is `linear`-eased between samples — the curve lives in the sample
|
|
29
|
+
* positions, not in the easing.
|
|
30
|
+
*/
|
|
31
|
+
export declare function bakeSpringTrack(track: AnyTrack, options?: BakeOptions): Track<number>;
|
|
32
|
+
/**
|
|
33
|
+
* Sample an inertia track into an ordinary keyframe track, the same way
|
|
34
|
+
* springs are baked.
|
|
35
|
+
*/
|
|
36
|
+
export declare function bakeInertiaTrack(track: AnyTrack, options?: BakeOptions): Track<number>;
|
|
37
|
+
/**
|
|
38
|
+
* Replace a keyframe segment's easing with sampled intermediate keyframes.
|
|
39
|
+
*
|
|
40
|
+
* Used for eases that cannot be represented as a single cubic-bezier — elastic,
|
|
41
|
+
* bounce and steps overshoot or jump, which a bezier cannot do. The segment
|
|
42
|
+
* keeps its endpoints and gains `linear` samples in between.
|
|
43
|
+
*/
|
|
44
|
+
export declare function bakeEasing<T extends Keyframe['value']>(from: Keyframe<T>, to: Keyframe<T>, easing: EasingType | ((t: number) => number), options?: BakeOptions): Keyframe<T>[];
|
|
45
|
+
/**
|
|
46
|
+
* Any track as a keyframed track — springs and inertia get baked, everything
|
|
47
|
+
* else passes through untouched. Export paths use this so they never see a
|
|
48
|
+
* computed track.
|
|
49
|
+
*/
|
|
50
|
+
export declare function toKeyframedTrack(track: AnyTrack, options?: BakeOptions): KeyframedTrack;
|
|
51
|
+
/**
|
|
52
|
+
* Sample every segment that arrives on a parametric ease (steps, elastic, bounce,
|
|
53
|
+
* back) into linear keyframes, for formats that only understand keyframes and
|
|
54
|
+
* beziers. Other segments are kept as they are. Returns the track itself when
|
|
55
|
+
* there is nothing to sample.
|
|
56
|
+
*/
|
|
57
|
+
export declare function expandParametricEasings<T extends KeyframedTrack>(track: T, options?: BakeOptions): T;
|
|
58
|
+
/** Bake a whole track list for export: computed tracks and parametric eases become keyframes. */
|
|
59
|
+
export declare function toKeyframedTracks(tracks: AnyTrack[], options?: BakeOptions): KeyframedTrack[];
|
|
60
|
+
/**
|
|
61
|
+
* Drop keyframes that lie within `tolerance` of the line between their
|
|
62
|
+
* neighbours. A plain sequential pass — not Douglas–Peucker — because sampled
|
|
63
|
+
* springs are smooth and dense, so the simple version removes nearly as much
|
|
64
|
+
* for a fraction of the complexity.
|
|
65
|
+
*/
|
|
66
|
+
export declare function simplifyKeyframes(keyframes: Keyframe<number>[], tolerance: number): Keyframe<number>[];
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
export interface ClockConfig {
|
|
2
|
+
/** Playback speed multiplier (1 = normal) */
|
|
3
|
+
speed?: number;
|
|
4
|
+
}
|
|
5
|
+
export type TickCallback = (delta: number, currentTime: number) => void;
|
|
6
|
+
/**
|
|
7
|
+
* Manual clock for testing and non-RAF environments.
|
|
8
|
+
* Time only advances when tick() is called explicitly.
|
|
9
|
+
*/
|
|
10
|
+
export declare class ManualClock {
|
|
11
|
+
private _currentTime;
|
|
12
|
+
private _isRunning;
|
|
13
|
+
onTick: TickCallback | null;
|
|
14
|
+
get currentTime(): number;
|
|
15
|
+
get isRunning(): boolean;
|
|
16
|
+
start(): void;
|
|
17
|
+
stop(): void;
|
|
18
|
+
tick(delta: number): void;
|
|
19
|
+
reset(): void;
|
|
20
|
+
seek(time: number): void;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* RAF-based clock for browser environments.
|
|
24
|
+
* Automatically advances time based on requestAnimationFrame.
|
|
25
|
+
*/
|
|
26
|
+
export declare class Clock {
|
|
27
|
+
private _currentTime;
|
|
28
|
+
private _isRunning;
|
|
29
|
+
private _lastFrameTime;
|
|
30
|
+
private _rafId;
|
|
31
|
+
private _speed;
|
|
32
|
+
onTick: TickCallback | null;
|
|
33
|
+
constructor(config?: ClockConfig);
|
|
34
|
+
get currentTime(): number;
|
|
35
|
+
get isRunning(): boolean;
|
|
36
|
+
get speed(): number;
|
|
37
|
+
set speed(value: number);
|
|
38
|
+
start(): void;
|
|
39
|
+
stop(): void;
|
|
40
|
+
reset(): void;
|
|
41
|
+
seek(time: number): void;
|
|
42
|
+
private _scheduleFrame;
|
|
43
|
+
private _onFrame;
|
|
44
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { InertiaConfig } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Inertia: a thrown value slowing to rest.
|
|
4
|
+
*
|
|
5
|
+
* Friction is exponential decay, which has an exact closed form:
|
|
6
|
+
*
|
|
7
|
+
* x(t) = from + (rest − from) · (1 − e^(−k·t))
|
|
8
|
+
*
|
|
9
|
+
* so `valueAt(t)` is a pure function of time — no integration, nothing to
|
|
10
|
+
* cache, identical whether you play forwards or scrub backwards. `k` is the
|
|
11
|
+
* friction; `rest` is where a free throw would stop (`from + velocity / k`),
|
|
12
|
+
* moved to the chosen snap point and into bounds if given.
|
|
13
|
+
*
|
|
14
|
+
* Aiming at a snap point keeps the feel of the throw: it decelerates at the
|
|
15
|
+
* same rate and simply lands on the snap, as if thrown with exactly the right
|
|
16
|
+
* speed — which is also how GSAP's InertiaPlugin lands on `end` values.
|
|
17
|
+
*/
|
|
18
|
+
export declare const DEFAULT_INERTIA_FRICTION = 4;
|
|
19
|
+
/** Safety cap on a throw's duration. */
|
|
20
|
+
export declare const INERTIA_MAX_DURATION_MS = 60000;
|
|
21
|
+
/** Where a free throw with these parameters would stop, before snapping or bounds. */
|
|
22
|
+
export declare function naturalRest(config: InertiaConfig): number;
|
|
23
|
+
/** Where the throw comes to rest: the natural rest, snapped, then kept in bounds. */
|
|
24
|
+
export declare function inertiaRest(config: InertiaConfig): number;
|
|
25
|
+
/** Milliseconds until the throw is within its rest threshold — its natural duration. */
|
|
26
|
+
export declare function inertiaDuration(config: InertiaConfig): number;
|
|
27
|
+
/** The value `timeMs` after release. Exactly the rest value once settled. */
|
|
28
|
+
export declare function inertiaValueAt(config: InertiaConfig, timeMs: number): number;
|
|
29
|
+
/** The speed `timeMs` after release, in units per second (useful for chaining a follow-up). */
|
|
30
|
+
export declare function inertiaVelocityAt(config: InertiaConfig, timeMs: number): number;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which points in time a playhead passed between two frames — the pure part of
|
|
3
|
+
* timeline callbacks (`call`, `addPause`, per-tween `onStart` / `onComplete`,
|
|
4
|
+
* `onRepeat`).
|
|
5
|
+
*
|
|
6
|
+
* A frame moves the playhead from one place to another, possibly across loop
|
|
7
|
+
* boundaries: a plain repeat wraps back to the start, a yoyo turns around. The
|
|
8
|
+
* movement is split into passes, and each pass reports the event times inside it
|
|
9
|
+
* in the order they were crossed:
|
|
10
|
+
*
|
|
11
|
+
* - forward, `(from, to]` — an event exactly where the playhead already was has
|
|
12
|
+
* fired before; a pass that starts a loop (or a first play) includes its start;
|
|
13
|
+
* - reverse, `[to, from)`.
|
|
14
|
+
*/
|
|
15
|
+
export type Direction = 'forward' | 'reverse';
|
|
16
|
+
export interface Playhead {
|
|
17
|
+
/** Milliseconds within the current loop */
|
|
18
|
+
time: number;
|
|
19
|
+
/** Loops completed */
|
|
20
|
+
iteration: number;
|
|
21
|
+
direction: Direction;
|
|
22
|
+
/** The playhead is at the very start of a pass, so an event at its position has not fired */
|
|
23
|
+
fresh?: boolean;
|
|
24
|
+
}
|
|
25
|
+
export type Crossing = {
|
|
26
|
+
kind: 'event';
|
|
27
|
+
index: number;
|
|
28
|
+
direction: Direction;
|
|
29
|
+
} | {
|
|
30
|
+
kind: 'repeat';
|
|
31
|
+
};
|
|
32
|
+
export interface CrossingResult {
|
|
33
|
+
crossings: Crossing[];
|
|
34
|
+
/** Every stretch of time covered, in order, as [from, to] (to < from when reversing) */
|
|
35
|
+
passes: Array<[number, number]>;
|
|
36
|
+
}
|
|
37
|
+
export interface LoopShape {
|
|
38
|
+
duration: number;
|
|
39
|
+
/** Yoyo: every other loop plays backwards */
|
|
40
|
+
alternate: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* The frame ended waiting out a repeat delay at a boundary. A plain repeat has
|
|
43
|
+
* not wrapped yet, so the last pass (the new loop) has not started.
|
|
44
|
+
*/
|
|
45
|
+
holding?: boolean;
|
|
46
|
+
}
|
|
47
|
+
export declare function playheadCrossings(times: readonly number[], from: Playhead, to: Playhead, shape: LoopShape): CrossingResult;
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import type { SpringConfig } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Deterministic spring simulation.
|
|
4
|
+
*
|
|
5
|
+
* The whole point of this module is that `valueAt(t)` is a *pure function of t*.
|
|
6
|
+
* A naive spring integrates from the previous frame's state, which makes output
|
|
7
|
+
* depend on frame rate and on the direction you scrubbed from — a timeline that
|
|
8
|
+
* looks different on a 144 Hz monitor, and that can't be exported. Instead we
|
|
9
|
+
* always integrate forward from rest at t=0 using a fixed substep, so seeking
|
|
10
|
+
* backwards to 300 ms gives the identical value as playing forward to 300 ms.
|
|
11
|
+
*
|
|
12
|
+
* The cost is that evaluating late times means simulating the earlier ones, so
|
|
13
|
+
* each spring memoises its samples and extends them as needed (`SpringSampler`).
|
|
14
|
+
*/
|
|
15
|
+
/** Integration substep in milliseconds. Small enough to be stable for stiff springs. */
|
|
16
|
+
export declare const SPRING_STEP_MS = 1;
|
|
17
|
+
/** Simulation is cut off here so a never-resting spring can't hang the engine. */
|
|
18
|
+
export declare const SPRING_MAX_DURATION_MS = 60000;
|
|
19
|
+
export declare const DEFAULT_SPRING: Required<Omit<SpringConfig, 'from' | 'to'>>;
|
|
20
|
+
/**
|
|
21
|
+
* Named springs for the two parameters that decide how one feels. Stiffness and
|
|
22
|
+
* damping interact, so named pairs are more useful than two sliders someone has
|
|
23
|
+
* to discover the combinations of. Shared by the editor and `spring: 'wobbly'`.
|
|
24
|
+
*/
|
|
25
|
+
export declare const SPRING_PRESETS: {
|
|
26
|
+
readonly gentle: {
|
|
27
|
+
readonly stiffness: 120;
|
|
28
|
+
readonly damping: 18;
|
|
29
|
+
readonly mass: 1;
|
|
30
|
+
};
|
|
31
|
+
readonly default: {
|
|
32
|
+
readonly stiffness: 180;
|
|
33
|
+
readonly damping: 12;
|
|
34
|
+
readonly mass: 1;
|
|
35
|
+
};
|
|
36
|
+
readonly snappy: {
|
|
37
|
+
readonly stiffness: 280;
|
|
38
|
+
readonly damping: 20;
|
|
39
|
+
readonly mass: 1;
|
|
40
|
+
};
|
|
41
|
+
readonly bouncy: {
|
|
42
|
+
readonly stiffness: 220;
|
|
43
|
+
readonly damping: 8;
|
|
44
|
+
readonly mass: 1;
|
|
45
|
+
};
|
|
46
|
+
readonly wobbly: {
|
|
47
|
+
readonly stiffness: 180;
|
|
48
|
+
readonly damping: 5;
|
|
49
|
+
readonly mass: 1;
|
|
50
|
+
};
|
|
51
|
+
readonly stiff: {
|
|
52
|
+
readonly stiffness: 400;
|
|
53
|
+
readonly damping: 30;
|
|
54
|
+
readonly mass: 1;
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
export type SpringPresetName = keyof typeof SPRING_PRESETS;
|
|
58
|
+
/**
|
|
59
|
+
* Samples a single spring, extending the simulation on demand and caching it.
|
|
60
|
+
*
|
|
61
|
+
* Instances are cheap; one is created per spring track.
|
|
62
|
+
*/
|
|
63
|
+
export declare class SpringSampler {
|
|
64
|
+
private readonly from;
|
|
65
|
+
private readonly to;
|
|
66
|
+
private readonly stiffness;
|
|
67
|
+
private readonly damping;
|
|
68
|
+
private readonly mass;
|
|
69
|
+
private readonly restDelta;
|
|
70
|
+
private readonly restSpeed;
|
|
71
|
+
/** value[i] is the spring's position at time i * SPRING_STEP_MS */
|
|
72
|
+
/**
|
|
73
|
+
* Travel distance, used to scale the rest thresholds.
|
|
74
|
+
*
|
|
75
|
+
* Without this the thresholds are absolute, and a spring animating `scale`
|
|
76
|
+
* from 0 to 1 hits them ~100x sooner than one animating `x` from 0 to 100 —
|
|
77
|
+
* so the small one is declared "settled" at its first pass through the
|
|
78
|
+
* target and never shows the overshoot at all. Scaling by travel makes
|
|
79
|
+
* settling depend on the spring's parameters, not on the units of whatever
|
|
80
|
+
* property it happens to drive.
|
|
81
|
+
*/
|
|
82
|
+
private readonly distance;
|
|
83
|
+
private samples;
|
|
84
|
+
private velocity;
|
|
85
|
+
/** Once at rest we stop simulating; every later time returns `to`. */
|
|
86
|
+
private settledStep;
|
|
87
|
+
constructor(config: SpringConfig);
|
|
88
|
+
/**
|
|
89
|
+
* Whether a position/velocity pair counts as settled.
|
|
90
|
+
*
|
|
91
|
+
* Both thresholds are fractions of the spring's travel distance:
|
|
92
|
+
* `restDelta` as a fraction of the distance, and `restSpeed` as a fraction
|
|
93
|
+
* of the distance per second. That keeps settling scale-invariant.
|
|
94
|
+
*/
|
|
95
|
+
private isAtRest;
|
|
96
|
+
/**
|
|
97
|
+
* Position at `timeMs`. Times before 0 clamp to the start value; times past
|
|
98
|
+
* settling return the target exactly.
|
|
99
|
+
*/
|
|
100
|
+
valueAt(timeMs: number): number;
|
|
101
|
+
/**
|
|
102
|
+
* How long the spring takes to settle, in milliseconds — the natural duration
|
|
103
|
+
* of a spring track. Runs the simulation to completion once.
|
|
104
|
+
*/
|
|
105
|
+
settleTime(): number;
|
|
106
|
+
/** Advance the cached simulation until it holds at least `steps` samples. */
|
|
107
|
+
private simulateTo;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* One-shot sampling helper. Prefer a long-lived `SpringSampler` when sampling
|
|
111
|
+
* repeatedly (playback) — this rebuilds the simulation each call.
|
|
112
|
+
*/
|
|
113
|
+
export declare function springValueAt(config: SpringConfig, timeMs: number): number;
|
|
114
|
+
/** Natural settle duration for a spring, in milliseconds. */
|
|
115
|
+
export declare function springDuration(config: SpringConfig): number;
|
|
116
|
+
/**
|
|
117
|
+
* Whether a spring passes its target before settling.
|
|
118
|
+
*
|
|
119
|
+
* A spring oscillates when it is damped less than critically, and critical
|
|
120
|
+
* damping is `2 * sqrt(stiffness * mass)`. Worth exposing rather than leaving
|
|
121
|
+
* to trial and error: overshoot is usually the whole point of reaching for a
|
|
122
|
+
* spring, and its absence is the most common reason a "bouncy" one looks flat.
|
|
123
|
+
*
|
|
124
|
+
* This is the closed-form test, so it is exact and costs nothing — no
|
|
125
|
+
* simulation required.
|
|
126
|
+
*/
|
|
127
|
+
export declare function isUnderdamped(config: SpringConfig): boolean;
|
|
128
|
+
/**
|
|
129
|
+
* Damping that would make this spring settle without overshooting — the
|
|
130
|
+
* critical-damping value for its stiffness and mass.
|
|
131
|
+
*/
|
|
132
|
+
export declare function criticalDamping(config: SpringConfig): number;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { StaggerConfig, StaggerFrom } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Stagger offset maths.
|
|
4
|
+
*
|
|
5
|
+
* One implementation shared by three callers: the editor's "fan a preset across
|
|
6
|
+
* letters" action, the runtime `targets` track (expanded during evaluation), and
|
|
7
|
+
* the GSAP compat facade's `stagger` var. Pure and deterministic — given an
|
|
8
|
+
* index and a count it always returns the same offset, so staggered output
|
|
9
|
+
* serializes and replays identically.
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Distance from the fan's origin, in "index steps", for one item.
|
|
13
|
+
*
|
|
14
|
+
* - `start` → 0, 1, 2, … (default; matches the editor's behaviour)
|
|
15
|
+
* - `end` → reversed
|
|
16
|
+
* - `center` → grows outward from the middle
|
|
17
|
+
* - `edges` → grows inward from both ends
|
|
18
|
+
* - number → distance from that index
|
|
19
|
+
*/
|
|
20
|
+
export declare function staggerDistance(index: number, count: number, from?: StaggerFrom): number;
|
|
21
|
+
/**
|
|
22
|
+
* The largest distance any item in the set can have. Used to convert a total
|
|
23
|
+
* `amount` into a per-step value.
|
|
24
|
+
*/
|
|
25
|
+
export declare function maxStaggerDistance(count: number, from?: StaggerFrom): number;
|
|
26
|
+
/**
|
|
27
|
+
* Time offset in milliseconds for one target in a staggered set.
|
|
28
|
+
*
|
|
29
|
+
* `amount` (total spread) wins over `each` (per-step gap) when both are given,
|
|
30
|
+
* matching GSAP. With neither, the offset is 0 — a stagger config that says
|
|
31
|
+
* nothing should do nothing rather than guess a default.
|
|
32
|
+
*/
|
|
33
|
+
export declare function staggerOffset(index: number, count: number, config: StaggerConfig): number;
|
|
34
|
+
/**
|
|
35
|
+
* Every offset for a set, in target order. Convenience for authoring tools that
|
|
36
|
+
* bake the stagger into separate tracks.
|
|
37
|
+
*/
|
|
38
|
+
export declare function staggerOffsets(count: number, config: StaggerConfig): number[];
|
|
39
|
+
/** The longest offset in a set — how much a stagger extends a timeline. */
|
|
40
|
+
export declare function staggerSpan(count: number, config: StaggerConfig): number;
|