The preview bar, the guard and diagnostics
The preview bar plays, steps, scrubs, checks and renders a composition in the browser. The guard positions CSS animations at each seek and warns about determinism hazards, and every Kinetic error and warning carries a KN code listed here by range.
?preview on the page's URL mounts the bar, and its Check button calls check({ samples: 30 }).
Warnings print in development builds only, so build with kinetic.wf.js while you work.
Errors are thrown on every build with the code in error.code, and a production error's message carries the code and a link to its entry.
The preview bar
The preview bar is a strip fixed to the bottom of the window, outside the composition root. It drives Kinetic's clock, or the runtime's player when one is on the page (Rendering through HyperFrames).
| Control | What it does |
|---|---|
| Play and pause button, one frame back, one frame forward, scrubber | Play and pause the composition, step it one frame back or forward, and scrub it. |
| Readout | Shows the time, duration and frame. |
| Render button | Makes the same call as render() and shows its progress in the readout. |
| Check button | Calls check({ samples: 30 }) when no render is running and shows "checking…" in the readout while it runs.
The verdict shows there for ten seconds, "check ok, 180 frames" or "check failed at frame 42: style". |
| Speaker button, after the frame steps | Turns the sound on and off when the composition has an audio clip (Sound in the preview). |
| Count, beside the readout | How many KN warnings and errors have printed since the page loaded, in amber above 0, and a click on it prints a reminder to open the console. The production build prints no KN warnings, so there it reads "production build, no diagnostics". |
Any of these mounts it after load.
?previewon the page's URL.data-previewon the extension's script tag.config({ preview: true }).
config({ preview: false }) removes it.
The bar never mounts with embed in the URL, where the page shows the composition alone (Embedding), or while a renderer is capturing.
When the bar is asked for, Kinetic also fits the stage to the window (the fit option of config()).
The guard
The guard has a CSS-animation catch-up, which runs in every build, and diagnostics for determinism hazards, which run in development builds.
CSS-animation catch-up
In every build, after each seek's flush and before the frame is captured, Kinetic positions every CSS animation under a scene that is not paused, since the runtime pauses the ones it seeks.
- It sets
currentTimeto the time since the start of the nearest[data-start]element, then pauses the animation, and it does so on every later seek. - With no runtime on the page it positions all of them, so a scrub in a plain tab shows what a render captures.
- An animation on an element created after load, such as a list row, is positioned the same way, so a CSS animation needs no warning and gets none.
Development diagnostics
Development builds watch the window between a seek's arrival and its capture, and warn once per code. The warnings for KN-140, KN-141, KN-142 and KN-145 include the line in your code that made the call, and a call made by the framework or the runtime is ignored. Each has an entry in the error codes reference.
| Code | Raised when |
|---|---|
| KN-140 | Date.now(), performance.now() or new Date() is read. |
| KN-141 | Math.random() is called. |
| KN-142 | A timer, fetch() or requestAnimationFrame() is started. |
| KN-143 | A CSS transition is running under the root. Off in interactive mode on a page with steps. |
| KN-145 | Number or date formatting runs with no locale. |
| KN-146 | In video mode, something other than a step's script wrote a scripted path, a watcher inside the script's own write included, and Kinetic put the script's value back. |
| KN-170 | A seek took longer than 8 ms to settle. |
Diagnostics
Kinetic's codes carry the prefix KN and are grouped by range, and each code has an entry on the error codes page.
| Range | Covers |
|---|---|
| KN-10x | Install and the seek channel. |
| KN-11x | The composition's markup. |
| KN-12x | Tracks and eases. |
| KN-13x | Inputs, readiness, audio clips and footage. |
| KN-14x | Determinism hazards seen during a seek. |
| KN-15x | The scene definition. |
| KN-16x | check(). |
| KN-17x | Seek cost. |
| KN-18x | Lottie and animated images. |
| KN-19x | WebGL (Trillium's views, effects, drawings and the finish). |
| KN-20x | render(). |
Warnings and errors
- Warnings print as
[KN-140] ...throughconsole.warnand exist in development builds only. With a development build of WildflowerJS they print throughwildflower.diagnostic(), which adds a Docs line and keeps each one inwildflower.diagnosticsbeside the framework's own. - Errors are thrown on every build as
Errorobjects with the code inerror.code, apart from the readiness failures, which print to the console and rejectready().
try {
await wildflower.kinetic.render({ audioBitrate: -1 });
} catch (error) {
error.code; // 'KN-100'
error.message; // '[KN-100] render({ audioBitrate })', then the explanation or a link
}
In the development build an error's message goes on to say what is wrong and how to fix it.
The production build's message carries the code, where the error came from, such as render({ audioBitrate }), and a link to the code's entry, so build with kinetic.wf.js and look a production error up by its code.
Clips, steps and transitions
Eighteen development warnings cover a page that runs and still shows or plays something other than what its author wrote. Each prints once per clip, track, input, scene, or step, and KN-137, KN-158, KN-202, and KN-205 once per page.
- KN-114 is a clip whose start or end falls between two frames, checked on each seek. The message gives the clip, the attribute, its value and the two nearest frame times.
- KN-118 is a
data-stepelement that is no step, having noidor nodata-start, two steps with oneid, a step inside another step, or two steps that start together (Steps). The message gives the step's element, and each of its problems prints once. - KN-118 is also a first step that starts after 0, or a step that starts at or past the composition's end, which
go()holds on the last frame. - KN-157 is
step()for an id nodata-stepelement has, or anuntilorfollowtarget whose store does not exist at readiness (Interactive mode). The message gives the step or scene and the path. - KN-157 is also a
waitlonger than the step's range, which is clamped, or a settings entry that starts after 0 in the first step that scripts its path. - KN-158 is a page with steps that the preview bar alone put in video mode under
config({ mode: 'auto' }), so the lesson plays as a video and its controls stop working (Interactive mode). For the lesson, removedata-preview, or callconfig({ mode: 'interactive' }). - KN-159 is a read of a key that a
keyframesentry's style object does not have, such asthis.rise.translateYwhenrisehas several tracks and translateY is folded intotransform(Keyframes). The message gives the scene, the entry, its keys, and the key read. - KN-115 is a
data-clip-transition,data-clip-enterordata-clip-exitthat Kinetic cannot apply, and KN-116 adata-clip-transitionthat overlaps no sibling clip or more than one, both checked on each seek. The message gives the clip, the attribute, its value and what is wrong with it, and the clip is left without the transition. - KN-115 is also a
luma,halftoneordissolvetransition on a clip that holds elements while its own box is empty, so nothing of it shows during the transition. - KN-156 is a property a transition wrote that a binding or a scene's
root:block wrote again on the same clip during the same seek, or that page code wrote between two seeks inside the window. The message gives the clip and the property.
Tracks, inputs, media and render
- KN-122 is a track on a length property such as
widththat gives numbers with nounit, checked when the scene is defined or whenstyleAt()orinterpolate()first reads the track. The message gives the scene, thekeyframesentry and the property. - KN-123 is a spring segment that its next keyframe cuts off while the spring is more than 2% of the distance between the keyframes from rest, checked at the same points. The message gives the segment's times, how far from rest the spring is in the track's unit, and how long the spring takes to come within 2% of rest.
- KN-134 is an input whose
defaultdiffers from the onedata-composition-variablesdeclares, which is the one the scene reads. The message gives the scene, the input and both defaults. - KN-136 is an audio clip with
loop,autoplayorcontrols, which Kinetic does not apply. It is also adata-remapthat is not applied, because Kinetic cannot read it or its ease overshoots, and adata-playback-ratebeside adata-remap. The message gives the clip and the attributes. - KN-139 is a footage clip with
autoplay,controls,loopordata-automation, which Kinetic does not apply, with neithermutednordata-has-audio="true"or with both, or with adata-playback-rateoutside 0.1 to 10, which is clamped. The message gives the clip and each attribute, with a suggestion for each. - KN-139 is also a footage clip with no length written whose media start is at or past the end of its file, so it is never shown.
- KN-139 is also a footage clip's
data-remapthat is not applied, because Kinetic cannot read it, its ease overshoots, or the HyperFrames runtime on the page drives the clip, and adata-playback-ratebeside adata-remap. - KN-137 is
level()orspectrum()read after a decode that found no audio clip, so the read is 0. - KN-202 is a render whose sound is Opus because the browser cannot encode AAC.
- KN-205 is a render with a shutter while a runtime's player drives the clock, which rounds each seek to its own frames, so the shutter is not applied (Rendering through HyperFrames).
- KN-191 is an effect or a drawing whose WebGL context the browser lost, so it draws nothing until the context is restored. The message gives the canvas, and for an effect the kind.
- KN-192 is a render with a finish while effects and drawings hold 16 WebGL contexts, so the finish's own makes Chrome drop the oldest, and that layer can come out blank.