@mizchi/vlmkit-animation-eval 0.23.1 → 0.24.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/README.md +20 -8
- package/dist/animation-eval.d.mts +267 -30
- package/dist/animation-eval.mjs +787 -59
- package/dist/frames-capture.d.mts +119 -0
- package/dist/frames-capture.mjs +422 -0
- package/dist/index.d.mts +3 -2
- package/dist/index.mjs +3 -2
- package/dist/virtual-clock.d.mts +71 -0
- package/dist/virtual-clock.mjs +691 -0
- package/package.json +6 -5
package/README.md
CHANGED
|
@@ -7,21 +7,33 @@ any pixels at all, when the page settles, whether `prefers-reduced-motion`
|
|
|
7
7
|
is honoured behaviourally, and whether something outside the Web Animations
|
|
8
8
|
API (rAF, video, GIF) is moving the page on its own.
|
|
9
9
|
|
|
10
|
-
It is the measurement behind
|
|
11
|
-
|
|
12
|
-
-
|
|
13
|
-
|
|
14
|
-
- `vlmkit-anim eval page.html` — the same report from the animation authoring
|
|
15
|
-
tool, on the pages it emits (package `@mizchi/vlmkit-anim`).
|
|
10
|
+
It is the measurement behind `vlmkit check animation page.html` — the gate,
|
|
11
|
+
with rule settings, `--json`, `--strip` filmstrips and the run ledger (package
|
|
12
|
+
`@mizchi/vlmkit-markup`) — and its clock holds `check integrity --timeline`.
|
|
13
|
+
Use it directly to get the same report without the rest of vlmkit.
|
|
16
14
|
|
|
17
15
|
```ts
|
|
18
16
|
import { runAnimationEval, formatAnimationEvalReport } from "@mizchi/vlmkit-animation-eval";
|
|
19
17
|
|
|
20
18
|
const report = await runAnimationEval({ source: "page.html", samples: 4 });
|
|
21
19
|
console.log(formatAnimationEvalReport(report));
|
|
22
|
-
report.issues; // [{ kind: "no-visible-effect" | "infinite-animation" | "reduced-motion-ignored" | "long-settle" | "uncontrolled-motion", severity, message, selector? }]
|
|
20
|
+
report.issues; // [{ kind: "no-visible-effect" | "infinite-animation" | "reduced-motion-ignored" | "long-settle" | "uncontrolled-motion" | "seek-ineffective" | "clock-motion-unsettled", severity, message, selector? }]
|
|
23
21
|
```
|
|
24
22
|
|
|
23
|
+
`virtualTime: true` (`--virtual-time` on the gate) holds the page clock —
|
|
24
|
+
`requestAnimationFrame`, `performance.now`, `Date`, `setTimeout`,
|
|
25
|
+
`setInterval` — from document start and advances it from the evaluator, so
|
|
26
|
+
script-driven motion is sampled as `report.clockMotion` instead of being
|
|
27
|
+
reported as uncontrolled. A page that renders from an explicit time can listen
|
|
28
|
+
for `vlmkit:seek` (`detail.timeMs`, `detail.waitUntil(promise)`). The clock is
|
|
29
|
+
exported on its own as `VIRTUAL_CLOCK_SCRIPT` (`virtual-clock.ts`).
|
|
30
|
+
|
|
25
31
|
`playwright` is a required peer: the whole job is driving a browser. Depends
|
|
26
32
|
on `@mizchi/vlmkit-core` for page loading, browser launch and PNG utilities,
|
|
27
|
-
and on
|
|
33
|
+
and on `@mizchi/vlmkit-judge` (pure, no dependencies of its own) for the frame
|
|
34
|
+
format and the instants a timeline is sampled at.
|
|
35
|
+
|
|
36
|
+
`frames-capture.ts` is the frames half: the page at chosen instants of its own
|
|
37
|
+
time (`captureTimelineFrames`), written as `vlmkit-frames/1` — numbered PNGs
|
|
38
|
+
plus a `frames.json` — which `check animation --frames` and
|
|
39
|
+
`check integrity --timeline --frames` both write.
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { PageLoadOptions } from "@mizchi/vlmkit-core/page-load.ts";
|
|
2
2
|
import { RuleView } from "@mizchi/vlmkit-core/plugin/contract.ts";
|
|
3
|
-
|
|
4
3
|
//#region src/animation-eval.d.ts
|
|
5
|
-
interface AnimationTimingSample {
|
|
4
|
+
export interface AnimationTimingSample {
|
|
6
5
|
/** Index into the page's animation list at capture time. */
|
|
7
6
|
index: number;
|
|
8
7
|
/** Best-effort stable selector of the animation's effect target. */
|
|
@@ -12,6 +11,8 @@ interface AnimationTimingSample {
|
|
|
12
11
|
name: string;
|
|
13
12
|
durationMs: number;
|
|
14
13
|
delayMs: number;
|
|
14
|
+
/** The timing function: the effect's, or a CSS animation's keyframes' ("a / b" when they differ). */
|
|
15
|
+
easing?: string;
|
|
15
16
|
/** null = infinite. */
|
|
16
17
|
iterations: number | null;
|
|
17
18
|
/** Play state as found on the page, captured BEFORE the evaluator pauses it. */
|
|
@@ -26,8 +27,14 @@ interface AnimationTimingSample {
|
|
|
26
27
|
* sweep even without `alternate`.
|
|
27
28
|
*/
|
|
28
29
|
palindromic: boolean;
|
|
30
|
+
/** The properties its keyframes animate (camelCase, as getKeyframes names them). */
|
|
31
|
+
properties?: string[];
|
|
32
|
+
/** animation-fill-mode as computed: none / forwards / backwards / both / auto. */
|
|
33
|
+
fill?: string;
|
|
34
|
+
/** Its first keyframe leaves the element unseen (opacity 0 or visibility hidden). */
|
|
35
|
+
startsHidden?: boolean;
|
|
29
36
|
}
|
|
30
|
-
interface OscillationInfo {
|
|
37
|
+
export interface OscillationInfo {
|
|
31
38
|
/** The animation sweeps out and back rather than jumping to restart. */
|
|
32
39
|
oscillating: boolean;
|
|
33
40
|
/** Duration of one visual leg (one extreme to the other), in ms. */
|
|
@@ -43,8 +50,8 @@ interface OscillationInfo {
|
|
|
43
50
|
* iteration per leg; palindromic keyframes complete out-and-back within a
|
|
44
51
|
* single iteration, so each leg is half the duration.
|
|
45
52
|
*/
|
|
46
|
-
declare function computeOscillation(t: Pick<AnimationTimingSample, "durationMs" | "direction" | "palindromic">): OscillationInfo;
|
|
47
|
-
interface FrameDeltaStat {
|
|
53
|
+
export declare function computeOscillation(t: Pick<AnimationTimingSample, "durationMs" | "direction" | "palindromic">): OscillationInfo;
|
|
54
|
+
export interface FrameDeltaStat {
|
|
48
55
|
changedPixels: number;
|
|
49
56
|
/** changedPixels / total pixels. */
|
|
50
57
|
ratio: number;
|
|
@@ -56,11 +63,11 @@ interface FrameDeltaStat {
|
|
|
56
63
|
height: number;
|
|
57
64
|
} | null;
|
|
58
65
|
}
|
|
59
|
-
interface AnimationFrameStat extends FrameDeltaStat {
|
|
66
|
+
export interface AnimationFrameStat extends FrameDeltaStat {
|
|
60
67
|
/** Sampled progress through one iteration (0..1]. */
|
|
61
68
|
fraction: number;
|
|
62
69
|
}
|
|
63
|
-
interface EvaluatedAnimation extends AnimationTimingSample {
|
|
70
|
+
export interface EvaluatedAnimation extends AnimationTimingSample {
|
|
64
71
|
frames: AnimationFrameStat[];
|
|
65
72
|
/** Any sampled interval moved at least minChangedPixels pixels. */
|
|
66
73
|
visible: boolean;
|
|
@@ -71,40 +78,151 @@ interface EvaluatedAnimation extends AnimationTimingSample {
|
|
|
71
78
|
width: number;
|
|
72
79
|
height: number;
|
|
73
80
|
} | null;
|
|
81
|
+
/** The animated element's own border box at rest, when its selector still matches. */
|
|
82
|
+
elementBox?: {
|
|
83
|
+
x: number;
|
|
84
|
+
y: number;
|
|
85
|
+
width: number;
|
|
86
|
+
height: number;
|
|
87
|
+
topmost?: number;
|
|
88
|
+
};
|
|
74
89
|
totalChangedPixels: number;
|
|
75
90
|
maxFrameRatio: number;
|
|
91
|
+
/**
|
|
92
|
+
* Why the frames above cannot be trusted as a function of the seeked time, when they cannot.
|
|
93
|
+
* Absent when every seek took and replaying the first sample reproduced its pixels.
|
|
94
|
+
*/
|
|
95
|
+
seekIneffective?: SeekIneffective;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Evidence that seeking this animation did not control what was captured. Two independent
|
|
99
|
+
* kinds, because each misses what the other sees:
|
|
100
|
+
*
|
|
101
|
+
* - `readback`: after a seek the Animation was no longer live, had gone `idle`, or did not
|
|
102
|
+
* report the time it was set to — the page cancelled or replaced it, so the gate was moving
|
|
103
|
+
* an object nothing renders.
|
|
104
|
+
* - `replay`: seeking back to the first sample time and capturing again did not reproduce that
|
|
105
|
+
* frame inside the motion region — something other than this animation's time drives those
|
|
106
|
+
* pixels (a script restarting it, a ticker drawing over it).
|
|
107
|
+
*
|
|
108
|
+
* The case that made this a rule: a page restarting its animation every 100ms
|
|
109
|
+
* (`style.animation = "none"; reflow; style.animation = ""`) came back with six `visible`
|
|
110
|
+
* animations and "No animation issues detected" — every pixel the gate credited to its seeks
|
|
111
|
+
* was the page's own restart. HyperFrames' `sweep_static` guards the same thing from the other
|
|
112
|
+
* side: a sweep whose seeks did nothing makes every other green meaningless.
|
|
113
|
+
*/
|
|
114
|
+
export interface SeekIneffective {
|
|
115
|
+
reason: "readback" | "replay";
|
|
116
|
+
/** Readback: what the Animation reported instead. Replay: pixels that differed inside the motion region. */
|
|
117
|
+
detail: string;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Motion driven by the page's own script — rAF loops, timers, a canvas — sampled by advancing
|
|
121
|
+
* the virtual clock (`virtual-clock.ts`) with every WAAPI animation held at rest.
|
|
122
|
+
*/
|
|
123
|
+
export interface ClockMotion {
|
|
124
|
+
/** Virtual-time span sampled, from document start. */
|
|
125
|
+
windowMs: number;
|
|
126
|
+
/** The instant of each sample, in ms of virtual time. */
|
|
127
|
+
times: number[];
|
|
128
|
+
/** Delta from the previous sample (the first from the t=0 baseline). */
|
|
129
|
+
frames: FrameDeltaStat[];
|
|
130
|
+
motionBbox: {
|
|
131
|
+
x: number;
|
|
132
|
+
y: number;
|
|
133
|
+
width: number;
|
|
134
|
+
height: number;
|
|
135
|
+
} | null;
|
|
136
|
+
visible: boolean;
|
|
137
|
+
/**
|
|
138
|
+
* The last sampled instant whose interval moved pixels; `null` when the final interval still
|
|
139
|
+
* moved, i.e. the motion had not stopped by the end of the window.
|
|
140
|
+
*/
|
|
141
|
+
settledAtMs: number | null;
|
|
142
|
+
/** Exceptions thrown by page callbacks while the clock advanced (they do not stop it). */
|
|
143
|
+
errors: string[];
|
|
144
|
+
/**
|
|
145
|
+
* CSS transitions and animations that came into being while the clock advanced — begun by a
|
|
146
|
+
* timer or a script, so the sweep's motion may be theirs and not a requestAnimationFrame loop.
|
|
147
|
+
*/
|
|
148
|
+
started?: Array<{
|
|
149
|
+
selector: string;
|
|
150
|
+
name: string;
|
|
151
|
+
kind: "transition" | "animation";
|
|
152
|
+
atMs: number;
|
|
153
|
+
durationMs?: number;
|
|
154
|
+
}>;
|
|
155
|
+
/**
|
|
156
|
+
* An animation already seen begun again while the clock ran — on a new element (a re-render
|
|
157
|
+
* replaced it) or on the same one. A quote whose innerHTML was rebuilt every second replayed
|
|
158
|
+
* its price's entrance, and under --virtual-time it read "visible" and nothing else (round 11).
|
|
159
|
+
*/
|
|
160
|
+
replays?: Array<{
|
|
161
|
+
selector: string;
|
|
162
|
+
name: string;
|
|
163
|
+
atMs: number[];
|
|
164
|
+
newElement: boolean;
|
|
165
|
+
}>;
|
|
166
|
+
/**
|
|
167
|
+
* What the clock ran in the window: animation-frame callbacks and timer runs. With no frame
|
|
168
|
+
* callback and timers at most 5 a second, the pixels change only when a timer updates the page
|
|
169
|
+
* (a clock, a live value): updates, not motion.
|
|
170
|
+
*/
|
|
171
|
+
runs?: {
|
|
172
|
+
frames: number;
|
|
173
|
+
timers: number;
|
|
174
|
+
};
|
|
76
175
|
}
|
|
77
|
-
|
|
176
|
+
/** Pure: the sweep's pixels changed only as a slow timer updated the page (no animation frames). */
|
|
177
|
+
export declare function clockUpdatesOnly(clock: Pick<ClockMotion, "runs" | "started" | "replays" | "windowMs">): boolean;
|
|
178
|
+
/** Pure: what a clock sweep's motion is, named as far as the page let it be. */
|
|
179
|
+
export declare function clockMotionSource(clock: Pick<ClockMotion, "started">): string;
|
|
180
|
+
/** Pure: the settle instant of a clock sweep — null when its last interval still moved. */
|
|
181
|
+
export declare function clockSettledAt(times: number[], frames: FrameDeltaStat[], minChangedPixels: number): number | null;
|
|
182
|
+
export interface ReducedMotionRemaining {
|
|
78
183
|
selector: string;
|
|
79
184
|
name: string;
|
|
80
185
|
durationMs: number;
|
|
81
186
|
}
|
|
82
|
-
type AnimationEvalIssueKind = "no-visible-effect" | "infinite-animation" | "reduced-motion-ignored" | "long-settle" | "uncontrolled-motion";
|
|
83
|
-
interface AnimationEvalIssue {
|
|
187
|
+
export type AnimationEvalIssueKind = "no-visible-effect" | "infinite-animation" | "reduced-motion-ignored" | "long-settle" | "uncontrolled-motion" | "seek-ineffective" | "clock-motion-unsettled" | "undefined-keyframes" | "motion-mostly-hidden" | "delayed-entrance" | "unknown-transition-property" | "reduced-motion-hides" | "layout-animation" | "loop-seam" | "stroke-incomplete" | "discrete-transition" | "animation-replayed" | "zero-duration-animation";
|
|
188
|
+
export interface AnimationEvalIssue {
|
|
84
189
|
kind: AnimationEvalIssueKind;
|
|
85
190
|
severity: "warn" | "suspect";
|
|
86
191
|
message: string;
|
|
87
192
|
selector?: string;
|
|
88
193
|
}
|
|
89
|
-
interface AnimationEvalReport {
|
|
194
|
+
export interface AnimationEvalReport {
|
|
90
195
|
source: string;
|
|
91
196
|
viewport: {
|
|
92
197
|
width: number;
|
|
93
198
|
height: number;
|
|
94
199
|
};
|
|
95
200
|
animationCount: number;
|
|
201
|
+
/** Animations on a scroll timeline: listed, not evaluated (inspect motion sweeps the scroll). */
|
|
202
|
+
scrollDriven?: {
|
|
203
|
+
selector: string;
|
|
204
|
+
name: string;
|
|
205
|
+
timeline: string;
|
|
206
|
+
}[];
|
|
96
207
|
evaluated: EvaluatedAnimation[];
|
|
97
208
|
/** Max over finite animations of delay + duration × iterations; null when an infinite animation is present. */
|
|
98
209
|
settleMs: number | null;
|
|
99
210
|
infinite: {
|
|
100
211
|
selector: string;
|
|
101
212
|
name: string;
|
|
213
|
+
indicator?: string;
|
|
102
214
|
}[];
|
|
103
215
|
/** Present unless the reduced-motion pass was skipped or there were no animations. */
|
|
104
216
|
reducedMotion?: {
|
|
105
217
|
remainingCount: number;
|
|
106
218
|
remaining: ReducedMotionRemaining[];
|
|
107
219
|
};
|
|
220
|
+
/** `animation-name`s with no @keyframes: nothing ran under them (`reducedMotion`: only under reduce). */
|
|
221
|
+
undefinedKeyframes?: {
|
|
222
|
+
selector: string;
|
|
223
|
+
name: string;
|
|
224
|
+
reducedMotion: boolean;
|
|
225
|
+
}[];
|
|
108
226
|
/**
|
|
109
227
|
* Pixel delta between two back-to-back rest captures with every WAAPI
|
|
110
228
|
* animation held still. Present (nonzero) means a motion source the Web
|
|
@@ -112,25 +230,48 @@ interface AnimationEvalReport {
|
|
|
112
230
|
* video, or GIF — is moving the page on its own.
|
|
113
231
|
*/
|
|
114
232
|
uncontrolledMotion?: FrameDeltaStat;
|
|
233
|
+
/** True when the page clock was held (`--virtual-time`); `uncontrolledMotion` then excludes script-driven motion. */
|
|
234
|
+
virtualTime?: boolean;
|
|
235
|
+
/** Script-driven motion sampled on the virtual clock. Present only with `--virtual-time`. */
|
|
236
|
+
clockMotion?: ClockMotion;
|
|
115
237
|
issues: AnimationEvalIssue[];
|
|
116
|
-
/**
|
|
238
|
+
/** The frame files `--frames` wrote, in sequence order. */
|
|
117
239
|
framePaths?: string[];
|
|
240
|
+
/**
|
|
241
|
+
* `--frames`: the viewport, uncropped, at each instant of its own time, clock and animations held, as a
|
|
242
|
+
* `vlmkit-frames/1` sequence (numbered PNGs + `frames.json`).
|
|
243
|
+
*/
|
|
244
|
+
frames?: {
|
|
245
|
+
dir: string;
|
|
246
|
+
manifest: string;
|
|
247
|
+
count: number;
|
|
248
|
+
unstable: number;
|
|
249
|
+
instants: number[];
|
|
250
|
+
/** Captured with `prefers-reduced-motion: reduce` emulated. */
|
|
251
|
+
reducedMotion?: boolean;
|
|
252
|
+
};
|
|
118
253
|
/** Written when `stripPath` was given: one image holding every sampled frame. */
|
|
119
254
|
strip?: {
|
|
120
255
|
path: string;
|
|
121
256
|
columns: number;
|
|
122
|
-
rows: number;
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
257
|
+
rows: number;
|
|
258
|
+
/** Evaluated animations left out because they moved no pixels. */
|
|
259
|
+
omitted: number;
|
|
260
|
+
/** Evaluated animations left out because `--strip-selector` did not match them. */
|
|
261
|
+
outOfScope: number;
|
|
262
|
+
/** Page-timeline span the columns cover, in ms. */
|
|
263
|
+
windowMs: number;
|
|
264
|
+
/** The instant each column was taken at, in ms from the animations' start. */
|
|
265
|
+
times: number[];
|
|
266
|
+
/** Row order, top to bottom. Empty for an animated strip, which has no rows. */
|
|
127
267
|
rowSelectors: string[];
|
|
128
268
|
width: number;
|
|
129
|
-
height: number;
|
|
269
|
+
height: number;
|
|
270
|
+
/** True when this is an animated PNG of the whole page rather than a cropped still sheet. */
|
|
130
271
|
animated?: boolean;
|
|
131
272
|
};
|
|
132
273
|
}
|
|
133
|
-
interface AnimationEvalOptions extends PageLoadOptions {
|
|
274
|
+
export interface AnimationEvalOptions extends PageLoadOptions {
|
|
134
275
|
source: string;
|
|
135
276
|
html?: string;
|
|
136
277
|
viewport?: {
|
|
@@ -151,8 +292,27 @@ interface AnimationEvalOptions extends PageLoadOptions {
|
|
|
151
292
|
reducedMotionDurationFloorMs?: number;
|
|
152
293
|
/** Skip the reduced-motion emulation pass. */
|
|
153
294
|
skipReducedMotion?: boolean;
|
|
154
|
-
/**
|
|
295
|
+
/**
|
|
296
|
+
* Hold the page clock (rAF, `performance.now`, `Date`, timers) from document start and drive
|
|
297
|
+
* it from the evaluator, so script-driven motion is sampled instead of reported as
|
|
298
|
+
* uncontrolled. See `virtual-clock.ts`.
|
|
299
|
+
*/
|
|
300
|
+
virtualTime?: boolean;
|
|
301
|
+
/** Virtual-time span to sample script-driven motion over (default 2000ms). */
|
|
302
|
+
clockWindowMs?: number;
|
|
303
|
+
/**
|
|
304
|
+
* Write the viewport, uncropped, at each instant (`at`, else each animation's start / middle / end plus a
|
|
305
|
+
* coarse grid) into this directory as a `vlmkit-frames/1` sequence. Captured on a page of its
|
|
306
|
+
* own with the clock held, so script-driven motion is at the instant too, `virtualTime` or not.
|
|
307
|
+
*/
|
|
155
308
|
framesDir?: string;
|
|
309
|
+
/** Capture `framesDir` with `prefers-reduced-motion: reduce` emulated: what that visitor sees. */
|
|
310
|
+
framesReducedMotion?: boolean;
|
|
311
|
+
/**
|
|
312
|
+
* Instants of page time, in ms: the frames `framesDir` writes and the strip's columns. Without
|
|
313
|
+
* it the strip's columns divide its window evenly.
|
|
314
|
+
*/
|
|
315
|
+
at?: readonly number[];
|
|
156
316
|
/**
|
|
157
317
|
* Composite every sampled frame into ONE image at this path, one row per
|
|
158
318
|
* animation. `--frames` writes N files a reader has to open in order; this
|
|
@@ -193,15 +353,15 @@ interface RgbaFrame {
|
|
|
193
353
|
* Pixel delta between two same-size RGBA frames: count, ratio, and the
|
|
194
354
|
* bounding box of every pixel whose any channel moved more than tolerance.
|
|
195
355
|
*/
|
|
196
|
-
declare function frameDelta(a: RgbaFrame, b: RgbaFrame, tolerance?: number): FrameDeltaStat;
|
|
356
|
+
export declare function frameDelta(a: RgbaFrame, b: RgbaFrame, tolerance?: number): FrameDeltaStat;
|
|
197
357
|
/**
|
|
198
358
|
* Rest-pose time for an animation: page-paused/finished animations stay at
|
|
199
359
|
* their author-chosen currentTime (their true resting appearance); running
|
|
200
360
|
* finite animations seek past their end (settled appearance); running
|
|
201
361
|
* infinite ones hold at 0.
|
|
202
362
|
*/
|
|
203
|
-
declare function restTimeForAnimation(t: AnimationTimingSample): number;
|
|
204
|
-
declare function unionBbox(a: {
|
|
363
|
+
export declare function restTimeForAnimation(t: AnimationTimingSample): number;
|
|
364
|
+
export declare function unionBbox(a: {
|
|
205
365
|
x: number;
|
|
206
366
|
y: number;
|
|
207
367
|
width: number;
|
|
@@ -218,25 +378,102 @@ declare function unionBbox(a: {
|
|
|
218
378
|
height: number;
|
|
219
379
|
} | null;
|
|
220
380
|
/** Max over finite animations of delay + duration × iterations; null when any animation is infinite. */
|
|
221
|
-
declare function computeSettleMs(animations: AnimationTimingSample[]): number | null;
|
|
222
|
-
|
|
381
|
+
export declare function computeSettleMs(animations: AnimationTimingSample[]): number | null;
|
|
382
|
+
/** An element that rests seen without reduced motion and hidden (or moved) with it. */
|
|
383
|
+
export interface ReducedHidden {
|
|
384
|
+
selector: string;
|
|
385
|
+
opacity: number;
|
|
386
|
+
reducedOpacity: number;
|
|
387
|
+
/** How far its centre rests from where it rests without the preference (px). */
|
|
388
|
+
offPx: number;
|
|
389
|
+
}
|
|
390
|
+
export interface DeriveIssuesInput {
|
|
223
391
|
evaluated: EvaluatedAnimation[];
|
|
224
392
|
settleMs: number | null;
|
|
225
393
|
infinite: {
|
|
226
394
|
selector: string;
|
|
227
395
|
name: string;
|
|
396
|
+
indicator?: string;
|
|
228
397
|
}[];
|
|
229
398
|
reducedMotion?: {
|
|
230
399
|
remainingCount: number;
|
|
231
400
|
remaining: ReducedMotionRemaining[];
|
|
232
401
|
};
|
|
233
402
|
uncontrolledMotion?: FrameDeltaStat;
|
|
403
|
+
virtualTime?: boolean;
|
|
404
|
+
clockMotion?: ClockMotion;
|
|
405
|
+
undefinedKeyframes?: {
|
|
406
|
+
selector: string;
|
|
407
|
+
name: string;
|
|
408
|
+
reducedMotion: boolean;
|
|
409
|
+
}[];
|
|
410
|
+
/** transition-property names no CSS property, with a duration over 0. */
|
|
411
|
+
unknownTransitions?: {
|
|
412
|
+
selector: string;
|
|
413
|
+
name: string;
|
|
414
|
+
}[];
|
|
415
|
+
/** CSS animations with no duration: they end as they begin. */
|
|
416
|
+
zeroDuration?: {
|
|
417
|
+
selector: string;
|
|
418
|
+
name: string;
|
|
419
|
+
}[];
|
|
420
|
+
/** A transition on background over a gradient, which does not interpolate. */
|
|
421
|
+
discreteTransitions?: {
|
|
422
|
+
selector: string;
|
|
423
|
+
name: string;
|
|
424
|
+
image: string;
|
|
425
|
+
}[];
|
|
426
|
+
/** Seen at rest without the preference, hidden or out of place at rest under reduce. */
|
|
427
|
+
reducedHidden?: ReducedHidden[];
|
|
428
|
+
/** What an animation does beyond its own box (`MOTION_SHAPE_SCRIPT`). */
|
|
429
|
+
shapes?: MotionShapes;
|
|
430
|
+
}
|
|
431
|
+
export interface MotionShapes {
|
|
432
|
+
/** An in-flow element animating a layout property, and what that moved. */
|
|
433
|
+
pushes: {
|
|
434
|
+
selector: string;
|
|
435
|
+
name: string;
|
|
436
|
+
props: string[];
|
|
437
|
+
moved: {
|
|
438
|
+
selector: string;
|
|
439
|
+
dx: number;
|
|
440
|
+
dy: number;
|
|
441
|
+
}[];
|
|
442
|
+
count: number;
|
|
443
|
+
}[];
|
|
444
|
+
/** A repeating animation whose run ends off the pose the next begins on. */
|
|
445
|
+
seams: {
|
|
446
|
+
selector: string;
|
|
447
|
+
name: string;
|
|
448
|
+
channel: string;
|
|
449
|
+
step: number;
|
|
450
|
+
usual: number;
|
|
451
|
+
unit: string;
|
|
452
|
+
prop: string;
|
|
453
|
+
from: string | null;
|
|
454
|
+
to: string | null;
|
|
455
|
+
}[];
|
|
456
|
+
/** A dashed stroke drawing itself that rests part drawn. */
|
|
457
|
+
strokes: {
|
|
458
|
+
selector: string;
|
|
459
|
+
name: string;
|
|
460
|
+
drawn: number;
|
|
461
|
+
note: string;
|
|
462
|
+
}[];
|
|
463
|
+
/** A looping animation on a loading indicator, and why it reads as one. */
|
|
464
|
+
indicators: {
|
|
465
|
+
index: number;
|
|
466
|
+
selector: string;
|
|
467
|
+
name: string;
|
|
468
|
+
why: string;
|
|
469
|
+
}[];
|
|
234
470
|
}
|
|
235
|
-
|
|
471
|
+
/** A delay this long (ms) at least, with the element held unseen through it, is a `delayed-entrance`. */
|
|
472
|
+
export declare const DELAYED_ENTRANCE_MS = 1000;
|
|
473
|
+
export declare function deriveAnimationIssues(input: DeriveIssuesInput, options?: {
|
|
236
474
|
settleThresholdMs?: number;
|
|
237
475
|
reducedMotionDurationFloorMs?: number;
|
|
238
476
|
}): AnimationEvalIssue[];
|
|
239
|
-
declare function runAnimationEval(options: AnimationEvalOptions): Promise<AnimationEvalReport>;
|
|
240
|
-
declare function formatAnimationEvalReport(report: AnimationEvalReport, rules?: RuleView): string;
|
|
241
|
-
//#endregion
|
|
242
|
-
export { AnimationEvalIssue, AnimationEvalIssueKind, AnimationEvalOptions, AnimationEvalReport, AnimationFrameStat, AnimationTimingSample, DeriveIssuesInput, EvaluatedAnimation, FrameDeltaStat, OscillationInfo, ReducedMotionRemaining, computeOscillation, computeSettleMs, deriveAnimationIssues, formatAnimationEvalReport, frameDelta, restTimeForAnimation, runAnimationEval, unionBbox };
|
|
477
|
+
export declare function runAnimationEval(options: AnimationEvalOptions): Promise<AnimationEvalReport>;
|
|
478
|
+
export declare function formatAnimationEvalReport(report: AnimationEvalReport, rules?: RuleView): string;
|
|
479
|
+
//#endregion
|