Introduced `offsetX` and `offsetY` as new animatable properties for visual elements, allowing for render-time translations without altering layout boxes. Updated the documentation to reflect these changes, ensuring clarity on their usage. Enhanced the type definitions and functionality in the editor API to support these new properties, improving the overall flexibility of animations in the application.
4.3 KiB
4.3 KiB
Element reference
PascalCase composition elements map 1:1 onto internal node types (lowercase tags are DOM vocabulary, valid only inside <Html> content):
| Element | Internal node | Notes |
|---|---|---|
<Scene> |
Geometry with Scene tag | Clips its children to width×height. Document root only. |
<Group> |
Geometry with Group tag | Container with a transform; auto-fits its size from its children. Takes no fill or explicit size. |
<Rect> |
Geometry with Solid paint | A filled rectangle; takes only paint children. |
<Video> |
Geometry with Video paint | src resolves to a video asset. |
<Image> |
Geometry with Image paint | src resolves to an image asset. |
<Audio> |
Geometry with Audio component and a hidden Waveform paint | No visual output; carries volume. |
<Text> |
Geometry with Text component | Children become editable glyphs. |
<Sequence> |
Sequential group | Track container for back-to-back clips; positions are explicit. |
<Captions> |
Caption node | Transcribes the enclosing scene's audio. |
<SolidPaint> |
Solid paint | Paint child. |
<LinearGradientPaint> / <RadialGradientPaint> |
Gradient paint | Paint child; takes <ColorStop> children. |
<ColorStop> |
Gradient color stop | Valid only inside gradient paints. |
<Html> |
Geometry with Html paint | Children are real, reactive HTML drawn into the box by the browser (html-in-canvas, flagged Chromium API). <HtmlPaint> is the paint child form. |
<Surface> |
Geometry with Surface paint | ref hands you a canvas to draw with any context type (2d, webgl, webgpu); sampled every frame. <SurfacePaint> is the paint child form. |
User-defined components are ordinary Solid components; they compose the elements above and carry no runtime cost. Only the elements above produce entities.
Coordinates and sizing
- Coordinates are pixels relative to the parent's box, origin top-left. No percentages, no layout keywords; explicit numbers until the layout engine lands.
- Every element's box defaults to its parent's box:
xandydefault to0,widthandheightdefault to the parent's size (the JSX analog ofposition: absolute; inset: 0). The scene's box is its requiredwidth×height. - How media pixels map into the box is controlled by
objectFit(default"cover"), never by the box itself. A generated asset's placeholder therefore always has a definite size, even before the asset exists.
Common props
All visual elements accept:
| Prop | Type | Default | Meaning |
|---|---|---|---|
key |
string |
none | Stable identity across mounts; required on document roots (see roots.md). |
name |
string |
none | Human-readable node name. |
x, y |
Animatable<number> |
0 |
Position relative to the parent, px. |
offsetX, offsetY |
Animatable<number> |
0 |
Render-time translation on top of x/y, px; moves the drawn content without changing the layout box. Subpixel values are kept. |
width, height |
Animatable<number> |
parent size | Box size, px. |
rotation |
Animatable<number> |
0 |
Rotation in degrees. |
opacity |
Animatable<number> |
1 |
0-1. |
cornerRadius |
Animatable<number> |
0 |
Uniform corner radius, px. |
start, end, sourceIn, sourceOut |
Time |
see timing.md | Temporal placement. |
transition |
TransitionSpec | null |
none | Transition into the next clip; direct children of <Sequence> only (see transitions.md). |
animations |
AnimationSpec[] |
none | Preset in/out animations over the clip's head and tail (see animations.md). |
Animatable props also take a keyframe list; see keyframes.md.
One property table
Common and per-element props share a single property table, exported as PatchProps from @diffusionstudio/jsx. dapi node patch accepts exactly these keys, with the same value requirements, as patch entries on existing nodes; JSX and CLI cannot drift.