@clipkit/runtime 1.0.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 +54 -0
- package/README.md +98 -0
- package/dist/animation/easings.d.ts +9 -0
- package/dist/animation/easings.d.ts.map +1 -0
- package/dist/animation/easings.js +230 -0
- package/dist/animation/easings.js.map +1 -0
- package/dist/animation/expr.d.ts +44 -0
- package/dist/animation/expr.d.ts.map +1 -0
- package/dist/animation/expr.js +236 -0
- package/dist/animation/expr.js.map +1 -0
- package/dist/animation/keyframes.d.ts +23 -0
- package/dist/animation/keyframes.d.ts.map +1 -0
- package/dist/animation/keyframes.js +117 -0
- package/dist/animation/keyframes.js.map +1 -0
- package/dist/animation/motion-path.d.ts +18 -0
- package/dist/animation/motion-path.d.ts.map +1 -0
- package/dist/animation/motion-path.js +269 -0
- package/dist/animation/motion-path.js.map +1 -0
- package/dist/animation/noise1d.d.ts +5 -0
- package/dist/animation/noise1d.d.ts.map +1 -0
- package/dist/animation/noise1d.js +27 -0
- package/dist/animation/noise1d.js.map +1 -0
- package/dist/animation/presets.d.ts +60 -0
- package/dist/animation/presets.d.ts.map +1 -0
- package/dist/animation/presets.js +221 -0
- package/dist/animation/presets.js.map +1 -0
- package/dist/assets/cache.d.ts +18 -0
- package/dist/assets/cache.d.ts.map +1 -0
- package/dist/assets/cache.js +56 -0
- package/dist/assets/cache.js.map +1 -0
- package/dist/assets/fonts.d.ts +20 -0
- package/dist/assets/fonts.d.ts.map +1 -0
- package/dist/assets/fonts.js +127 -0
- package/dist/assets/fonts.js.map +1 -0
- package/dist/assets/loader.d.ts +18 -0
- package/dist/assets/loader.d.ts.map +1 -0
- package/dist/assets/loader.js +87 -0
- package/dist/assets/loader.js.map +1 -0
- package/dist/assets/lut.d.ts +5 -0
- package/dist/assets/lut.d.ts.map +1 -0
- package/dist/assets/lut.js +77 -0
- package/dist/assets/lut.js.map +1 -0
- package/dist/assets/media-time.d.ts +31 -0
- package/dist/assets/media-time.d.ts.map +1 -0
- package/dist/assets/media-time.js +65 -0
- package/dist/assets/media-time.js.map +1 -0
- package/dist/assets/mp4-frame-source.d.ts +44 -0
- package/dist/assets/mp4-frame-source.d.ts.map +1 -0
- package/dist/assets/mp4-frame-source.js +387 -0
- package/dist/assets/mp4-frame-source.js.map +1 -0
- package/dist/audio/encoder.d.ts +31 -0
- package/dist/audio/encoder.d.ts.map +1 -0
- package/dist/audio/encoder.js +96 -0
- package/dist/audio/encoder.js.map +1 -0
- package/dist/audio/fades.d.ts +16 -0
- package/dist/audio/fades.d.ts.map +1 -0
- package/dist/audio/fades.js +43 -0
- package/dist/audio/fades.js.map +1 -0
- package/dist/audio/limiter.d.ts +8 -0
- package/dist/audio/limiter.d.ts.map +1 -0
- package/dist/audio/limiter.js +39 -0
- package/dist/audio/limiter.js.map +1 -0
- package/dist/audio/loader.d.ts +6 -0
- package/dist/audio/loader.d.ts.map +1 -0
- package/dist/audio/loader.js +42 -0
- package/dist/audio/loader.js.map +1 -0
- package/dist/audio/mixer.d.ts +17 -0
- package/dist/audio/mixer.d.ts.map +1 -0
- package/dist/audio/mixer.js +204 -0
- package/dist/audio/mixer.js.map +1 -0
- package/dist/audio/varispeed.d.ts +24 -0
- package/dist/audio/varispeed.d.ts.map +1 -0
- package/dist/audio/varispeed.js +114 -0
- package/dist/audio/varispeed.js.map +1 -0
- package/dist/audio/wav.d.ts +6 -0
- package/dist/audio/wav.d.ts.map +1 -0
- package/dist/audio/wav.js +62 -0
- package/dist/audio/wav.js.map +1 -0
- package/dist/backend/backend.d.ts +579 -0
- package/dist/backend/backend.d.ts.map +1 -0
- package/dist/backend/backend.js +17 -0
- package/dist/backend/backend.js.map +1 -0
- package/dist/backend/webgl-backend.d.ts +97 -0
- package/dist/backend/webgl-backend.d.ts.map +1 -0
- package/dist/backend/webgl-backend.js +2142 -0
- package/dist/backend/webgl-backend.js.map +1 -0
- package/dist/backend/webgpu-backend.d.ts +121 -0
- package/dist/backend/webgpu-backend.d.ts.map +1 -0
- package/dist/backend/webgpu-backend.js +2481 -0
- package/dist/backend/webgpu-backend.js.map +1 -0
- package/dist/compositor/bitfont.d.ts +8 -0
- package/dist/compositor/bitfont.d.ts.map +1 -0
- package/dist/compositor/bitfont.js +52 -0
- package/dist/compositor/bitfont.js.map +1 -0
- package/dist/compositor/camera.d.ts +5 -0
- package/dist/compositor/camera.d.ts.map +1 -0
- package/dist/compositor/camera.js +114 -0
- package/dist/compositor/camera.js.map +1 -0
- package/dist/compositor/color.d.ts +26 -0
- package/dist/compositor/color.d.ts.map +1 -0
- package/dist/compositor/color.js +189 -0
- package/dist/compositor/color.js.map +1 -0
- package/dist/compositor/element-renderers/caption.d.ts +4 -0
- package/dist/compositor/element-renderers/caption.d.ts.map +1 -0
- package/dist/compositor/element-renderers/caption.js +376 -0
- package/dist/compositor/element-renderers/caption.js.map +1 -0
- package/dist/compositor/element-renderers/group.d.ts +12 -0
- package/dist/compositor/element-renderers/group.d.ts.map +1 -0
- package/dist/compositor/element-renderers/group.js +259 -0
- package/dist/compositor/element-renderers/group.js.map +1 -0
- package/dist/compositor/element-renderers/image.d.ts +4 -0
- package/dist/compositor/element-renderers/image.d.ts.map +1 -0
- package/dist/compositor/element-renderers/image.js +97 -0
- package/dist/compositor/element-renderers/image.js.map +1 -0
- package/dist/compositor/element-renderers/lit.d.ts +6 -0
- package/dist/compositor/element-renderers/lit.d.ts.map +1 -0
- package/dist/compositor/element-renderers/lit.js +82 -0
- package/dist/compositor/element-renderers/lit.js.map +1 -0
- package/dist/compositor/element-renderers/particles.d.ts +4 -0
- package/dist/compositor/element-renderers/particles.d.ts.map +1 -0
- package/dist/compositor/element-renderers/particles.js +212 -0
- package/dist/compositor/element-renderers/particles.js.map +1 -0
- package/dist/compositor/element-renderers/shape.d.ts +4 -0
- package/dist/compositor/element-renderers/shape.d.ts.map +1 -0
- package/dist/compositor/element-renderers/shape.js +171 -0
- package/dist/compositor/element-renderers/shape.js.map +1 -0
- package/dist/compositor/element-renderers/svg.d.ts +4 -0
- package/dist/compositor/element-renderers/svg.d.ts.map +1 -0
- package/dist/compositor/element-renderers/svg.js +210 -0
- package/dist/compositor/element-renderers/svg.js.map +1 -0
- package/dist/compositor/element-renderers/text.d.ts +25 -0
- package/dist/compositor/element-renderers/text.d.ts.map +1 -0
- package/dist/compositor/element-renderers/text.js +1358 -0
- package/dist/compositor/element-renderers/text.js.map +1 -0
- package/dist/compositor/element-renderers/video.d.ts +12 -0
- package/dist/compositor/element-renderers/video.d.ts.map +1 -0
- package/dist/compositor/element-renderers/video.js +109 -0
- package/dist/compositor/element-renderers/video.js.map +1 -0
- package/dist/compositor/fit.d.ts +18 -0
- package/dist/compositor/fit.d.ts.map +1 -0
- package/dist/compositor/fit.js +106 -0
- package/dist/compositor/fit.js.map +1 -0
- package/dist/compositor/lighting.d.ts +63 -0
- package/dist/compositor/lighting.d.ts.map +1 -0
- package/dist/compositor/lighting.js +141 -0
- package/dist/compositor/lighting.js.map +1 -0
- package/dist/compositor/mat4.d.ts +88 -0
- package/dist/compositor/mat4.d.ts.map +1 -0
- package/dist/compositor/mat4.js +245 -0
- package/dist/compositor/mat4.js.map +1 -0
- package/dist/compositor/project.d.ts +24 -0
- package/dist/compositor/project.d.ts.map +1 -0
- package/dist/compositor/project.js +105 -0
- package/dist/compositor/project.js.map +1 -0
- package/dist/compositor/render-context.d.ts +194 -0
- package/dist/compositor/render-context.d.ts.map +1 -0
- package/dist/compositor/render-context.js +10 -0
- package/dist/compositor/render-context.js.map +1 -0
- package/dist/compositor/resolve.d.ts +80 -0
- package/dist/compositor/resolve.d.ts.map +1 -0
- package/dist/compositor/resolve.js +276 -0
- package/dist/compositor/resolve.js.map +1 -0
- package/dist/compositor/scene.d.ts +10 -0
- package/dist/compositor/scene.d.ts.map +1 -0
- package/dist/compositor/scene.js +658 -0
- package/dist/compositor/scene.js.map +1 -0
- package/dist/compositor/transform.d.ts +73 -0
- package/dist/compositor/transform.d.ts.map +1 -0
- package/dist/compositor/transform.js +229 -0
- package/dist/compositor/transform.js.map +1 -0
- package/dist/compositor/unit.d.ts +27 -0
- package/dist/compositor/unit.d.ts.map +1 -0
- package/dist/compositor/unit.js +74 -0
- package/dist/compositor/unit.js.map +1 -0
- package/dist/encoder/exporter.d.ts +95 -0
- package/dist/encoder/exporter.d.ts.map +1 -0
- package/dist/encoder/exporter.js +341 -0
- package/dist/encoder/exporter.js.map +1 -0
- package/dist/encoder/index.d.ts +3 -0
- package/dist/encoder/index.d.ts.map +1 -0
- package/dist/encoder/index.js +2 -0
- package/dist/encoder/index.js.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +27 -0
- package/dist/index.js.map +1 -0
- package/dist/logger.d.ts +13 -0
- package/dist/logger.d.ts.map +1 -0
- package/dist/logger.js +32 -0
- package/dist/logger.js.map +1 -0
- package/dist/runtime.d.ts +216 -0
- package/dist/runtime.d.ts.map +1 -0
- package/dist/runtime.js +1012 -0
- package/dist/runtime.js.map +1 -0
- package/dist/svg/morph.d.ts +6 -0
- package/dist/svg/morph.d.ts.map +1 -0
- package/dist/svg/morph.js +62 -0
- package/dist/svg/morph.js.map +1 -0
- package/dist/svg/svg-renderer.d.ts +18 -0
- package/dist/svg/svg-renderer.d.ts.map +1 -0
- package/dist/svg/svg-renderer.js +142 -0
- package/dist/svg/svg-renderer.js.map +1 -0
- package/dist/text/caption-chunk.d.ts +17 -0
- package/dist/text/caption-chunk.d.ts.map +1 -0
- package/dist/text/caption-chunk.js +76 -0
- package/dist/text/caption-chunk.js.map +1 -0
- package/dist/text/font-atlas.d.ts +63 -0
- package/dist/text/font-atlas.d.ts.map +1 -0
- package/dist/text/font-atlas.js +225 -0
- package/dist/text/font-atlas.js.map +1 -0
- package/dist/text/measure.d.ts +38 -0
- package/dist/text/measure.d.ts.map +1 -0
- package/dist/text/measure.js +164 -0
- package/dist/text/measure.js.map +1 -0
- package/dist/text/text-animation.d.ts +52 -0
- package/dist/text/text-animation.d.ts.map +1 -0
- package/dist/text/text-animation.js +133 -0
- package/dist/text/text-animation.js.map +1 -0
- package/package.json +47 -0
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import type { Backend, RenderTarget, Texture } from '../backend/backend.js';
|
|
2
|
+
import type { AssetCache } from '../assets/cache.js';
|
|
3
|
+
import type { Mp4FrameSource } from '../assets/mp4-frame-source.js';
|
|
4
|
+
import type { FontAtlas } from '../text/font-atlas.js';
|
|
5
|
+
import type { CanvasDimensions } from './unit.js';
|
|
6
|
+
import type { ResolvedEnvironment, ResolvedLight } from './lighting.js';
|
|
7
|
+
export interface ImageAsset {
|
|
8
|
+
bitmap: ImageBitmap;
|
|
9
|
+
texture: Texture;
|
|
10
|
+
}
|
|
11
|
+
export interface VideoAsset {
|
|
12
|
+
/**
|
|
13
|
+
* The decoding element when the runtime owns playback via the DOM
|
|
14
|
+
* (page contexts). Null in worker contexts.
|
|
15
|
+
*/
|
|
16
|
+
video: HTMLVideoElement | null;
|
|
17
|
+
/**
|
|
18
|
+
* Deterministic WebCodecs decode path (fetch + demux + VideoDecoder)
|
|
19
|
+
* — the primary video source in worker contexts, where
|
|
20
|
+
* HTMLVideoElement doesn't exist. `runtime.prepareVideoFrames(t)`
|
|
21
|
+
* pulls the exact frame for each render time and uploads it before
|
|
22
|
+
* the synchronous frame() pass.
|
|
23
|
+
*/
|
|
24
|
+
frameSource: Mp4FrameSource | null;
|
|
25
|
+
texture: Texture;
|
|
26
|
+
/**
|
|
27
|
+
* Element-backed: video.currentTime at last upload. FrameSource-
|
|
28
|
+
* backed: the µs timestamp of the last uploaded frame. Externally
|
|
29
|
+
* pumped: unused (uploads happen at push time).
|
|
30
|
+
*/
|
|
31
|
+
lastUploadedTime: number;
|
|
32
|
+
/** Natural media width in pixels (videoWidth for element-backed assets). */
|
|
33
|
+
width: number;
|
|
34
|
+
/** Natural media height in pixels. */
|
|
35
|
+
height: number;
|
|
36
|
+
}
|
|
37
|
+
export interface SvgRasterAsset {
|
|
38
|
+
canvas: OffscreenCanvas;
|
|
39
|
+
ctx: OffscreenCanvasRenderingContext2D;
|
|
40
|
+
texture: Texture;
|
|
41
|
+
/**
|
|
42
|
+
* Pixel signature — frame-to-frame compared in renderPathShape
|
|
43
|
+
* so a static (or unchanged) SVG can skip the expensive raster +
|
|
44
|
+
* GPU upload and just redraw the cached texture. Big win for the
|
|
45
|
+
* common case where an SVG sits on screen after its path-draw
|
|
46
|
+
* animation has settled at progress=1.
|
|
47
|
+
*
|
|
48
|
+
* undefined when the cache entry was just created (forces first
|
|
49
|
+
* raster pass).
|
|
50
|
+
*/
|
|
51
|
+
lastSignature?: SvgRasterSignature;
|
|
52
|
+
}
|
|
53
|
+
export interface SvgRasterSignature {
|
|
54
|
+
/** Resolved trim window per path: flat [start, end, offset] triples. */
|
|
55
|
+
trims: number[];
|
|
56
|
+
/** Resolved d-string per path (morphing makes these time-varying). */
|
|
57
|
+
ds: string[];
|
|
58
|
+
/** Reference to element.paths array — changes only on source edits. */
|
|
59
|
+
pathsRef: unknown;
|
|
60
|
+
/** Reference to element.gradients — same. */
|
|
61
|
+
gradientsRef: unknown;
|
|
62
|
+
/** Raster canvas dimensions used. Changes if displayed size shifts. */
|
|
63
|
+
rasterW: number;
|
|
64
|
+
rasterH: number;
|
|
65
|
+
}
|
|
66
|
+
export interface MaskedTextAsset {
|
|
67
|
+
canvas: OffscreenCanvas;
|
|
68
|
+
ctx: OffscreenCanvasRenderingContext2D;
|
|
69
|
+
texture: Texture;
|
|
70
|
+
}
|
|
71
|
+
/** Parsed .cube LUT, packed as an N²×N 2D atlas texture (§4.7 `lut`). */
|
|
72
|
+
export interface LutAsset {
|
|
73
|
+
texture: Texture;
|
|
74
|
+
/** Lattice size N (LUT_3D_SIZE). */
|
|
75
|
+
size: number;
|
|
76
|
+
}
|
|
77
|
+
/** Per-group offscreen layer for `clip: true`, keyed by element id. */
|
|
78
|
+
export interface GroupClipTarget {
|
|
79
|
+
target: RenderTarget;
|
|
80
|
+
/** Logical dims the target was allocated at (recreated on change). */
|
|
81
|
+
width: number;
|
|
82
|
+
height: number;
|
|
83
|
+
/**
|
|
84
|
+
* Frame index (RenderContext.frameIndex) this entry was last acquired.
|
|
85
|
+
* Drives frame-boundary LRU eviction of the offscreen-FBO pool: after
|
|
86
|
+
* endFrame(), entries NOT touched this frame are the only eviction
|
|
87
|
+
* candidates, dropped least-recently-touched first to bound peak GPU memory
|
|
88
|
+
* on SwiftShader. Undefined only between create and first stamp.
|
|
89
|
+
*/
|
|
90
|
+
lastTouched?: number;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* 4×4 transform matrix (CKP/1.0 §4.4), column-major f64 — see
|
|
94
|
+
* compositor/mat4.ts for the element layout and operations.
|
|
95
|
+
*
|
|
96
|
+
* `aff` marks a pure 2D affine embedded in the 4×4 (trivial z/w rows
|
|
97
|
+
* and columns): affine×affine operations run the exact CKP/1.0 float
|
|
98
|
+
* expressions, keeping 2D documents byte-identical. The flag is load-
|
|
99
|
+
* bearing for that guarantee — never construct a Mat4 with `aff: true`
|
|
100
|
+
* unless the extra slots really are trivial.
|
|
101
|
+
*/
|
|
102
|
+
export interface Mat4 {
|
|
103
|
+
/** 16 elements, column-major: e[col * 4 + row]. */
|
|
104
|
+
e: number[];
|
|
105
|
+
/** True when the matrix is a 2D affine embedded in 4×4. */
|
|
106
|
+
aff: boolean;
|
|
107
|
+
}
|
|
108
|
+
export declare const MAT4_IDENTITY: Mat4;
|
|
109
|
+
export interface RenderContext {
|
|
110
|
+
backend: Backend;
|
|
111
|
+
canvas: CanvasDimensions;
|
|
112
|
+
/** Global time in seconds. Used for animation evaluation. */
|
|
113
|
+
time: number;
|
|
114
|
+
/**
|
|
115
|
+
* Total duration of the current source in seconds. Used to resolve
|
|
116
|
+
* `duration: "auto"` and `time: "end"` for elements and animations.
|
|
117
|
+
*/
|
|
118
|
+
sourceDuration: number;
|
|
119
|
+
/**
|
|
120
|
+
* Monotonic eviction epoch from the runtime (NOT a 1:1 output-frame count).
|
|
121
|
+
* Stamped onto every acquired groupTargets pool entry so post-endFrame LRU
|
|
122
|
+
* eviction can tell which entries were touched this frame (never evicted)
|
|
123
|
+
* from stale ones. Constant across all motion-blur sub-frame samples of one
|
|
124
|
+
* output frame (makeContext does not bump it).
|
|
125
|
+
*/
|
|
126
|
+
frameIndex: number;
|
|
127
|
+
images: AssetCache<ImageAsset>;
|
|
128
|
+
videos: AssetCache<VideoAsset>;
|
|
129
|
+
fontAtlases: AssetCache<FontAtlas>;
|
|
130
|
+
/**
|
|
131
|
+
* Per-element rasterization caches for elements that draw to an
|
|
132
|
+
* OffscreenCanvas each frame and upload to a single texture. Keyed by
|
|
133
|
+
* element.id (or a synthesized key when id is absent).
|
|
134
|
+
*/
|
|
135
|
+
svgRasters: AssetCache<SvgRasterAsset>;
|
|
136
|
+
maskedTexts: AssetCache<MaskedTextAsset>;
|
|
137
|
+
/** Offscreen layers for clipped groups. */
|
|
138
|
+
groupTargets: AssetCache<GroupClipTarget>;
|
|
139
|
+
/** Parsed .cube LUT atlases, keyed by source URL. */
|
|
140
|
+
luts: AssetCache<LutAsset>;
|
|
141
|
+
/**
|
|
142
|
+
* Current model matrix. Identity at the root; group elements push their
|
|
143
|
+
* own transform onto this when rendering children, and pop afterwards.
|
|
144
|
+
* Element renderers read this and apply it to their computed positions
|
|
145
|
+
* before emitting draw calls.
|
|
146
|
+
*/
|
|
147
|
+
modelMatrix: Mat4;
|
|
148
|
+
/**
|
|
149
|
+
* §4.8 lighting: the cumulative transform WITHOUT the scene camera —
|
|
150
|
+
* identity at the root, group locals multiply in (parallel to
|
|
151
|
+
* modelMatrix). An element's world-space placement for lighting is
|
|
152
|
+
* `worldMatrix · localQuad`; combined with `eye`, that gives the
|
|
153
|
+
* view-dependent specular that sweeps as the camera moves. (modelMatrix
|
|
154
|
+
* bakes in the camera P·V, so it can't be used for world-space shading.)
|
|
155
|
+
*/
|
|
156
|
+
worldMatrix: Mat4;
|
|
157
|
+
/** Resolved scene lights at this frame (§4.8). Empty ⇒ unlit. */
|
|
158
|
+
lights: ResolvedLight[];
|
|
159
|
+
/** Camera eye in world space (§4.8); view-vector origin for specular. */
|
|
160
|
+
eye: [number, number, number];
|
|
161
|
+
/** Resolved scene environment (§4.8); reflective materials sample it. Null ⇒ no reflections. */
|
|
162
|
+
environment: ResolvedEnvironment | null;
|
|
163
|
+
/**
|
|
164
|
+
* §4.4.3 2.5D depth sort. When set, sibling draw lists (top-level
|
|
165
|
+
* elements and the children of plain, non-flattened groups) paint
|
|
166
|
+
* back-to-front by depth (eye-space `z`) instead of pure `track`
|
|
167
|
+
* order. `z` orders always — true unless `camera.sort: 'paint'`, or
|
|
168
|
+
* (with no camera) the doc has no depth fields at all, in which case
|
|
169
|
+
* it stays plain track order, byte-identical to a 2D document.
|
|
170
|
+
*/
|
|
171
|
+
depthSort: boolean;
|
|
172
|
+
/**
|
|
173
|
+
* Cumulative opacity factor in [0, 1]. Group elements multiply their
|
|
174
|
+
* own opacity into this when rendering children. Element renderers
|
|
175
|
+
* multiply their own opacity by this before computing tints.
|
|
176
|
+
*/
|
|
177
|
+
opacityFactor: number;
|
|
178
|
+
/**
|
|
179
|
+
* Time offset applied to children of a group, in seconds. Children's
|
|
180
|
+
* `time` is interpreted relative to this offset (so a child with
|
|
181
|
+
* `time: 0` inside a group at `time: 3` fires at global time 3).
|
|
182
|
+
*/
|
|
183
|
+
timeOffset: number;
|
|
184
|
+
/**
|
|
185
|
+
* LOGICAL dimensions of the surface currently receiving draws — the
|
|
186
|
+
* canvas at the root, a group's box while rendering into its
|
|
187
|
+
* clip/mask layers. Filtered elements (blur_radius / brightness /
|
|
188
|
+
* contrast / saturation) allocate their offscreen layers at exactly
|
|
189
|
+
* this size so the 1:1 composite back is exact at any nesting depth.
|
|
190
|
+
*/
|
|
191
|
+
surfaceWidth: number;
|
|
192
|
+
surfaceHeight: number;
|
|
193
|
+
}
|
|
194
|
+
//# sourceMappingURL=render-context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render-context.d.ts","sourceRoot":"","sources":["../../src/compositor/render-context.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAC5E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAClD,OAAO,KAAK,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAExE,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,WAAW,CAAC;IACpB,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,UAAU;IACzB;;;OAGG;IACH,KAAK,EAAE,gBAAgB,GAAG,IAAI,CAAC;IAC/B;;;;;;OAMG;IACH,WAAW,EAAE,cAAc,GAAG,IAAI,CAAC;IACnC,OAAO,EAAE,OAAO,CAAC;IACjB;;;;OAIG;IACH,gBAAgB,EAAE,MAAM,CAAC;IACzB,4EAA4E;IAC5E,KAAK,EAAE,MAAM,CAAC;IACd,sCAAsC;IACtC,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,eAAe,CAAC;IACxB,GAAG,EAAE,iCAAiC,CAAC;IACvC,OAAO,EAAE,OAAO,CAAC;IACjB;;;;;;;;;OASG;IACH,aAAa,CAAC,EAAE,kBAAkB,CAAC;CACpC;AAED,MAAM,WAAW,kBAAkB;IACjC,wEAAwE;IACxE,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,sEAAsE;IACtE,EAAE,EAAE,MAAM,EAAE,CAAC;IACb,uEAAuE;IACvE,QAAQ,EAAE,OAAO,CAAC;I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IACzC,2CAA2C;IAC3C,YAAY,EAAE,UAAU,CAAC,eAAe,CAAC,CAAC;IAC1C,qDAAqD;IACrD,IAAI,EAAE,UAAU,CAAC,QAAQ,CAAC,CAAC;IAE3B;;;;;OAKG;IACH,WAAW,EAAE,IAAI,CAAC;IAClB;;;;;;;OAOG;IACH,WAAW,EAAE,IAAI,CAAC;IAClB,iEAAiE;IACjE,MAAM,EAAE,aAAa,EAAE,CAAC;IACxB,yEAAyE;IACzE,GAAG,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IAC9B,gGAAgG;IAChG,WAAW,EAAE,mBAAmB,GAAG,IAAI,CAAC;IACxC;;;;;;;OAOG;IACH,SAAS,EAAE,OAAO,CAAC;IACnB;;;;OAIG;IACH,aAAa,EAAE,MAAM,CAAC;IACtB;;;;OAIG;IACH,UAAU,EAAE,MAAM,CAAC;IACnB;;;;;;OAMG;IACH,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;CACvB"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// Shared context object threaded through element renderers.
|
|
2
|
+
//
|
|
3
|
+
// The runtime populates this once per frame and hands it to each
|
|
4
|
+
// renderElement(...) call. Renderers read what they need and call into
|
|
5
|
+
// the backend to emit draw commands.
|
|
6
|
+
export const MAT4_IDENTITY = {
|
|
7
|
+
e: [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1],
|
|
8
|
+
aff: true,
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=render-context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render-context.js","sourceRoot":"","sources":["../../src/compositor/render-context.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,EAAE;AACF,iEAAiE;AACjE,uEAAuE;AACvE,qCAAqC;AAsHrC,MAAM,CAAC,MAAM,aAAa,GAAS;IACjC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;IACnD,GAAG,EAAE,IAAI;CACV,CAAC"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import type { BaseElement, Element } from '@clipkit/protocol';
|
|
2
|
+
import type { RenderContext } from './render-context.js';
|
|
3
|
+
/**
|
|
4
|
+
* Apply animations to a property's static value. Returns the static value
|
|
5
|
+
* unchanged if no animation targets this property at the current time.
|
|
6
|
+
*/
|
|
7
|
+
export declare function applyAnimation(element: BaseElement, property: string, staticValue: number, ctx: RenderContext): number;
|
|
8
|
+
/**
|
|
9
|
+
* Resolve the element's CKP/1.0 3D transform (§4.4.1) at the current
|
|
10
|
+
* time. Returns null when the element carries none of the 3D fields —
|
|
11
|
+
* the renderer's signal to stay on the byte-stable 2D fast path.
|
|
12
|
+
* `z_rotation` is NOT 3D (it's the in-plane `rotation` alias, resolved
|
|
13
|
+
* through the normal rotation slot).
|
|
14
|
+
*/
|
|
15
|
+
export declare function resolve3D(element: BaseElement, ctx: RenderContext): {
|
|
16
|
+
xRot: number;
|
|
17
|
+
yRot: number;
|
|
18
|
+
z: number;
|
|
19
|
+
} | null;
|
|
20
|
+
/**
|
|
21
|
+
* §4.4.3 depth key: the EYE-SPACE z of the element's anchor under the
|
|
22
|
+
* current model matrix. The perspective matrix P leaves the z output row
|
|
23
|
+
* untouched (its row 2 is [0,0,1,0]), so the z component of `M·anchor`
|
|
24
|
+
* is the eye-space depth whether or not a camera/perspective is present —
|
|
25
|
+
* with no camera it is simply `element.z`. LARGER z = nearer the viewer.
|
|
26
|
+
* Resolved with the same `applyAnimation` / `resolve3D` path the renderer
|
|
27
|
+
* uses, so the sort matches what's drawn.
|
|
28
|
+
*/
|
|
29
|
+
export declare function cameraDepthZ(el: Element, ctx: RenderContext): number;
|
|
30
|
+
/**
|
|
31
|
+
* Stable back-to-front order by depth (farthest painted first → nearest
|
|
32
|
+
* on top). `elements` MUST already be in `track` order; equal depths fall
|
|
33
|
+
* back to that order (the explicit index tiebreak keeps it stable across
|
|
34
|
+
* engines). Sorting by ascending eye-space z puts the farthest (smallest
|
|
35
|
+
* z) first. Used by the scene and plain-group child walkers when
|
|
36
|
+
* `ctx.depthSort` is set. With all z equal (e.g. a 2D doc) this is a
|
|
37
|
+
* stable no-op → pure track order.
|
|
38
|
+
*/
|
|
39
|
+
export declare function depthOrder(elements: readonly Element[], ctx: RenderContext): Element[];
|
|
40
|
+
/**
|
|
41
|
+
* Resolve the element's effective per-axis scale at the current time:
|
|
42
|
+
* uniform `scale` (factor, default 1) multiplied with per-axis
|
|
43
|
+
* `x_scale` / `y_scale` (factor, or "N%" string). All three are
|
|
44
|
+
* animatable — via keyframe_animations or preset tweens (scale-in,
|
|
45
|
+
* squash, …).
|
|
46
|
+
*
|
|
47
|
+
* Renderers multiply their resolved width/height (and, for glyph-based
|
|
48
|
+
* renderers, glyph offsets around the pivot) by the returned factors.
|
|
49
|
+
*/
|
|
50
|
+
export declare function resolveScalePair(element: BaseElement, ctx: RenderContext): {
|
|
51
|
+
sx: number;
|
|
52
|
+
sy: number;
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* Derive the missing box dimension from `aspect_ratio` (width/height).
|
|
56
|
+
* Only applies when EXACTLY ONE of width/height is authored — both or
|
|
57
|
+
* neither leaves the resolved values untouched.
|
|
58
|
+
*/
|
|
59
|
+
export declare function applyAspectRatio(element: BaseElement, width: number, height: number): {
|
|
60
|
+
width: number;
|
|
61
|
+
height: number;
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
* Resolve a color property (fill_color, stroke_color, …) at the current
|
|
65
|
+
* time. When a keyframe_animation targets the property with color-string
|
|
66
|
+
* values, the colors are lerped componentwise in straight-alpha RGB
|
|
67
|
+
* space and returned as a CSS rgba() string — so renderers consume the
|
|
68
|
+
* result through the exact same string paths as static schema values.
|
|
69
|
+
* Falls back to the static color otherwise.
|
|
70
|
+
*/
|
|
71
|
+
export declare function resolveColorProperty(element: BaseElement, property: string, staticColor: string | undefined, ctx: RenderContext): string | undefined;
|
|
72
|
+
/**
|
|
73
|
+
* Resolve the element's shear angles (degrees, CSS skewX/skewY
|
|
74
|
+
* semantics) at the current time. Animatable like any other property.
|
|
75
|
+
*/
|
|
76
|
+
export declare function resolveSkewPair(element: BaseElement, ctx: RenderContext): {
|
|
77
|
+
skewX: number;
|
|
78
|
+
skewY: number;
|
|
79
|
+
};
|
|
80
|
+
//# sourceMappingURL=resolve.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve.d.ts","sourceRoot":"","sources":["../../src/compositor/resolve.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAc9D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEzD;;;GAGG;AACH,wBAAgB,cAAc,CAC5B,OAAO,EAAE,WAAW,EACpB,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,MAAM,EACnB,GAAG,EAAE,aAAa,GACjB,MAAM,CAoCR;AAgFD;;;;;;GAMG;AACH,wBAAgB,SAAS,CACvB,OAAO,EAAE,WAAW,EACpB,GAAG,EAAE,aAAa,GACjB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAsBlD;AAMD;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAAC,EAAE,EAAE,OAAO,EAAE,GAAG,EAAE,aAAa,GAAG,MAAM,CAMpE;AAED;;;;;;;;GAQG;AACH,wBAAgB,UAAU,CAAC,QAAQ,EAAE,SAAS,OAAO,EAAE,EAAE,GAAG,EAAE,aAAa,GAAG,OAAO,EAAE,CAKtF;AAED;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,WAAW,EACpB,GAAG,EAAE,aAAa,GACjB;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,CAK5B;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,WAAW,EACpB,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,GACb;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAUnC;AAED;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,WAAW,EACpB,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,MAAM,GAAG,SAAS,EAC/B,GAAG,EAAE,aAAa,GACjB,MAAM,GAAG,SAAS,CAYpB;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAC7B,OAAO,EAAE,WAAW,EACpB,GAAG,EAAE,aAAa,GACjB;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAKlC"}
|
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
// Animation-aware property resolution.
|
|
2
|
+
//
|
|
3
|
+
// Each element renderer first resolves the static schema value (e.g.
|
|
4
|
+
// `element.x → 100 pixels`), then calls applyAnimation() to overlay any
|
|
5
|
+
// active keyframe animation or named-preset tween for that property.
|
|
6
|
+
//
|
|
7
|
+
// Precedence (highest wins):
|
|
8
|
+
// 1. Keyframe animation matching the property
|
|
9
|
+
// 2. Named-preset tween (relative = added to static, absolute = replaces)
|
|
10
|
+
// 3. Static schema value (fallback)
|
|
11
|
+
import { foldKeyframeTime, interpolateColorKeyframes, interpolateKeyframes, isColorKeyframes, } from '../animation/keyframes.js';
|
|
12
|
+
import { noise1d } from '../animation/noise1d.js';
|
|
13
|
+
import { isExpr, evalExpr } from '../animation/expr.js';
|
|
14
|
+
import { resolveMotionPath } from '../animation/motion-path.js';
|
|
15
|
+
import { compileAnimation } from '../animation/presets.js';
|
|
16
|
+
import { applyEasing } from '../animation/easings.js';
|
|
17
|
+
import { rgbaToCss } from './color.js';
|
|
18
|
+
import { resolveLength } from './unit.js';
|
|
19
|
+
/**
|
|
20
|
+
* Apply animations to a property's static value. Returns the static value
|
|
21
|
+
* unchanged if no animation targets this property at the current time.
|
|
22
|
+
*/
|
|
23
|
+
export function applyAnimation(element, property, staticValue, ctx) {
|
|
24
|
+
// Group children's `time` is relative to the group's start —
|
|
25
|
+
// ctx.timeOffset carries that base (0 at the root).
|
|
26
|
+
const elementStart = ctx.timeOffset + numberOrZero(element.time);
|
|
27
|
+
const elementDuration = parseDuration(element.duration, ctx.sourceDuration - elementStart);
|
|
28
|
+
// Clamp to the element's lifespan. The active-window check computes
|
|
29
|
+
// the element's end as start + duration while this computes
|
|
30
|
+
// time - start; at exact frame boundaries (the exporter samples
|
|
31
|
+
// N/framerate precisely) float asymmetry can make localTime land a
|
|
32
|
+
// hair PAST elementDuration while the element is still considered
|
|
33
|
+
// active — skipping every end-anchored tween for one frame and
|
|
34
|
+
// flashing the static value (the "fade-out flickers back" export
|
|
35
|
+
// bug). An element's local time can't exceed its own duration.
|
|
36
|
+
const localTime = Math.min(ctx.time - elementStart, elementDuration);
|
|
37
|
+
// 0. A spatial motion path (§6.7) drives x and y — and z on 3D
|
|
38
|
+
// paths — and, with auto_orient, adds the xy travel direction to
|
|
39
|
+
// rotation (in-plane only; dz never orients).
|
|
40
|
+
if (property === 'x' || property === 'y' || property === 'z' || property === 'rotation') {
|
|
41
|
+
const path = resolveMotionPath(element, localTime);
|
|
42
|
+
if (path) {
|
|
43
|
+
if (property === 'x')
|
|
44
|
+
return path.x;
|
|
45
|
+
if (property === 'y')
|
|
46
|
+
return path.y;
|
|
47
|
+
if (property === 'z' && path.z !== null)
|
|
48
|
+
return path.z;
|
|
49
|
+
if (property === 'rotation' && path.autoOrient) {
|
|
50
|
+
// Resolve the element's own rotation normally, then orient.
|
|
51
|
+
const base = scalarAnimation(element, 'rotation', staticValue, localTime, elementDuration);
|
|
52
|
+
return base + path.angle;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return scalarAnimation(element, property, staticValue, localTime, elementDuration);
|
|
57
|
+
}
|
|
58
|
+
/** The scalar resolution chain (expression → keyframes → presets → static). */
|
|
59
|
+
function scalarAnimation(element, property, staticValue, localTime, elementDuration) {
|
|
60
|
+
// 0. A Tier-A expression on the property (§Expressions) — a pure function of
|
|
61
|
+
// `t`/`i`/`n`/`dur`/`value` — overrides everything. `z_rotation` shares the
|
|
62
|
+
// `rotation` slot.
|
|
63
|
+
const raw = element[property]
|
|
64
|
+
?? (property === 'rotation' ? element.z_rotation : undefined);
|
|
65
|
+
if (isExpr(raw)) {
|
|
66
|
+
return evalExpr(raw, { t: localTime, dur: elementDuration, i: 0, n: 1, value: staticValue });
|
|
67
|
+
}
|
|
68
|
+
// 1. Keyframe animations override the static value. `z_rotation` is
|
|
69
|
+
// the same slot as `rotation` (§4.4) — accept either spelling.
|
|
70
|
+
const keyframeAnims = element.keyframe_animations;
|
|
71
|
+
if (keyframeAnims) {
|
|
72
|
+
for (const kf of keyframeAnims) {
|
|
73
|
+
if (kf.property === property || (property === 'rotation' && kf.property === 'z_rotation')) {
|
|
74
|
+
return interpolateKeyframes(kf.keyframes, foldKeyframeTime(kf.keyframes, kf.loop, localTime));
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
// 2. Named animations apply tweens. Relative tweens add to static,
|
|
79
|
+
// absolute tweens replace.
|
|
80
|
+
const namedAnims = element.animations;
|
|
81
|
+
if (namedAnims && namedAnims.length > 0) {
|
|
82
|
+
let result = staticValue;
|
|
83
|
+
let modified = false;
|
|
84
|
+
for (const anim of namedAnims) {
|
|
85
|
+
const tweens = compileAnimation(anim, elementDuration);
|
|
86
|
+
for (const tween of tweens) {
|
|
87
|
+
if (tween.property !== property)
|
|
88
|
+
continue;
|
|
89
|
+
const tweenEnd = tween.startTime + tween.duration;
|
|
90
|
+
if (localTime < tween.startTime) {
|
|
91
|
+
// Before the window: fill-backward tweens (entrance presets)
|
|
92
|
+
// hold their `from` value so a delayed entrance stays hidden at
|
|
93
|
+
// frame 0; everything else releases back to the static value.
|
|
94
|
+
if (!tween.fillBackwards)
|
|
95
|
+
continue;
|
|
96
|
+
result = tween.relative ? staticValue + tween.from : tween.from;
|
|
97
|
+
modified = true;
|
|
98
|
+
continue;
|
|
99
|
+
}
|
|
100
|
+
// Past the window: fill-forward tweens keep applying their end
|
|
101
|
+
// value; everything else releases back to the static value.
|
|
102
|
+
if (localTime > tweenEnd && !tween.hold)
|
|
103
|
+
continue;
|
|
104
|
+
const span = tween.duration > 0 ? Math.min(1, (localTime - tween.startTime) / tween.duration) : 1;
|
|
105
|
+
const easedT = applyEasing(tween.easing, span);
|
|
106
|
+
let tweenValue = tween.from + (tween.to - tween.from) * easedT;
|
|
107
|
+
if (tween.oscillate) {
|
|
108
|
+
// from/to define the amplitude envelope; the value oscillates
|
|
109
|
+
// around 0 so oscillating tweens are inherently relative.
|
|
110
|
+
const ot = localTime - tween.startTime;
|
|
111
|
+
tweenValue *= tween.oscillate.noise
|
|
112
|
+
? (noise1d(tween.oscillate.frequency * ot, tween.oscillate.noise.seed) - 0.5) * 2
|
|
113
|
+
: Math.sin(2 * Math.PI * tween.oscillate.frequency * ot + (tween.oscillate.phase ?? 0));
|
|
114
|
+
}
|
|
115
|
+
result = tween.relative ? staticValue + tweenValue : tweenValue;
|
|
116
|
+
modified = true;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
if (modified)
|
|
120
|
+
return result;
|
|
121
|
+
}
|
|
122
|
+
return staticValue;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Resolve the element's CKP/1.0 3D transform (§4.4.1) at the current
|
|
126
|
+
* time. Returns null when the element carries none of the 3D fields —
|
|
127
|
+
* the renderer's signal to stay on the byte-stable 2D fast path.
|
|
128
|
+
* `z_rotation` is NOT 3D (it's the in-plane `rotation` alias, resolved
|
|
129
|
+
* through the normal rotation slot).
|
|
130
|
+
*/
|
|
131
|
+
export function resolve3D(element, ctx) {
|
|
132
|
+
const el = element;
|
|
133
|
+
const has = el.x_rotation !== undefined || el.y_rotation !== undefined || el.z !== undefined ||
|
|
134
|
+
element.keyframe_animations?.some((k) => k.property === 'x_rotation' || k.property === 'y_rotation' || k.property === 'z' ||
|
|
135
|
+
// A 3D position path (§6.7) drives z, so it puts the element
|
|
136
|
+
// on the matrix path even with no 3D fields authored.
|
|
137
|
+
(k.property === 'position' &&
|
|
138
|
+
k.keyframes.some((kf) => Array.isArray(kf.value) && kf.value.length === 3)));
|
|
139
|
+
if (!has)
|
|
140
|
+
return null;
|
|
141
|
+
return {
|
|
142
|
+
xRot: applyAnimation(element, 'x_rotation', staticNumber(el.x_rotation), ctx),
|
|
143
|
+
yRot: applyAnimation(element, 'y_rotation', staticNumber(el.y_rotation), ctx),
|
|
144
|
+
z: applyAnimation(element, 'z', staticNumber(el.z), ctx),
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
function staticNumber(v) {
|
|
148
|
+
return typeof v === 'number' && Number.isFinite(v) ? v : 0;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* §4.4.3 depth key: the EYE-SPACE z of the element's anchor under the
|
|
152
|
+
* current model matrix. The perspective matrix P leaves the z output row
|
|
153
|
+
* untouched (its row 2 is [0,0,1,0]), so the z component of `M·anchor`
|
|
154
|
+
* is the eye-space depth whether or not a camera/perspective is present —
|
|
155
|
+
* with no camera it is simply `element.z`. LARGER z = nearer the viewer.
|
|
156
|
+
* Resolved with the same `applyAnimation` / `resolve3D` path the renderer
|
|
157
|
+
* uses, so the sort matches what's drawn.
|
|
158
|
+
*/
|
|
159
|
+
export function cameraDepthZ(el, ctx) {
|
|
160
|
+
const m = ctx.modelMatrix.e;
|
|
161
|
+
const x = applyAnimation(el, 'x', resolveLength(el.x, ctx.canvas.width, ctx.canvas), ctx);
|
|
162
|
+
const y = applyAnimation(el, 'y', resolveLength(el.y, ctx.canvas.height, ctx.canvas), ctx);
|
|
163
|
+
const z = resolve3D(el, ctx)?.z ?? 0;
|
|
164
|
+
return m[2] * x + m[6] * y + m[10] * z + m[14];
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Stable back-to-front order by depth (farthest painted first → nearest
|
|
168
|
+
* on top). `elements` MUST already be in `track` order; equal depths fall
|
|
169
|
+
* back to that order (the explicit index tiebreak keeps it stable across
|
|
170
|
+
* engines). Sorting by ascending eye-space z puts the farthest (smallest
|
|
171
|
+
* z) first. Used by the scene and plain-group child walkers when
|
|
172
|
+
* `ctx.depthSort` is set. With all z equal (e.g. a 2D doc) this is a
|
|
173
|
+
* stable no-op → pure track order.
|
|
174
|
+
*/
|
|
175
|
+
export function depthOrder(elements, ctx) {
|
|
176
|
+
return elements
|
|
177
|
+
.map((el, i) => ({ el, i, z: cameraDepthZ(el, ctx) }))
|
|
178
|
+
.sort((a, b) => a.z - b.z || a.i - b.i)
|
|
179
|
+
.map((o) => o.el);
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Resolve the element's effective per-axis scale at the current time:
|
|
183
|
+
* uniform `scale` (factor, default 1) multiplied with per-axis
|
|
184
|
+
* `x_scale` / `y_scale` (factor, or "N%" string). All three are
|
|
185
|
+
* animatable — via keyframe_animations or preset tweens (scale-in,
|
|
186
|
+
* squash, …).
|
|
187
|
+
*
|
|
188
|
+
* Renderers multiply their resolved width/height (and, for glyph-based
|
|
189
|
+
* renderers, glyph offsets around the pivot) by the returned factors.
|
|
190
|
+
*/
|
|
191
|
+
export function resolveScalePair(element, ctx) {
|
|
192
|
+
const uniform = applyAnimation(element, 'scale', scaleOr(element.scale, 1), ctx);
|
|
193
|
+
const xs = applyAnimation(element, 'x_scale', scaleOr(element.x_scale, 1), ctx);
|
|
194
|
+
const ys = applyAnimation(element, 'y_scale', scaleOr(element.y_scale, 1), ctx);
|
|
195
|
+
return { sx: uniform * xs, sy: uniform * ys };
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Derive the missing box dimension from `aspect_ratio` (width/height).
|
|
199
|
+
* Only applies when EXACTLY ONE of width/height is authored — both or
|
|
200
|
+
* neither leaves the resolved values untouched.
|
|
201
|
+
*/
|
|
202
|
+
export function applyAspectRatio(element, width, height) {
|
|
203
|
+
const ar = element.aspect_ratio;
|
|
204
|
+
if (typeof ar !== 'number' || !(ar > 0))
|
|
205
|
+
return { width, height };
|
|
206
|
+
if (element.width !== undefined && element.height === undefined) {
|
|
207
|
+
return { width, height: width / ar };
|
|
208
|
+
}
|
|
209
|
+
if (element.height !== undefined && element.width === undefined) {
|
|
210
|
+
return { width: height * ar, height };
|
|
211
|
+
}
|
|
212
|
+
return { width, height };
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* Resolve a color property (fill_color, stroke_color, …) at the current
|
|
216
|
+
* time. When a keyframe_animation targets the property with color-string
|
|
217
|
+
* values, the colors are lerped componentwise in straight-alpha RGB
|
|
218
|
+
* space and returned as a CSS rgba() string — so renderers consume the
|
|
219
|
+
* result through the exact same string paths as static schema values.
|
|
220
|
+
* Falls back to the static color otherwise.
|
|
221
|
+
*/
|
|
222
|
+
export function resolveColorProperty(element, property, staticColor, ctx) {
|
|
223
|
+
const keyframeAnims = element.keyframe_animations;
|
|
224
|
+
if (keyframeAnims) {
|
|
225
|
+
for (const kf of keyframeAnims) {
|
|
226
|
+
if (kf.property === property && isColorKeyframes(kf.keyframes)) {
|
|
227
|
+
const elementStart = ctx.timeOffset + numberOrZero(element.time);
|
|
228
|
+
const localTime = foldKeyframeTime(kf.keyframes, kf.loop, ctx.time - elementStart);
|
|
229
|
+
return rgbaToCss(interpolateColorKeyframes(kf.keyframes, localTime));
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
return staticColor;
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* Resolve the element's shear angles (degrees, CSS skewX/skewY
|
|
237
|
+
* semantics) at the current time. Animatable like any other property.
|
|
238
|
+
*/
|
|
239
|
+
export function resolveSkewPair(element, ctx) {
|
|
240
|
+
return {
|
|
241
|
+
skewX: applyAnimation(element, 'x_skew', numberOrZero(element.x_skew), ctx),
|
|
242
|
+
skewY: applyAnimation(element, 'y_skew', numberOrZero(element.y_skew), ctx),
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
|
+
/** Parse a scale factor: number as-is, "150%" → 1.5, anything else → fallback. */
|
|
246
|
+
function scaleOr(v, fallback) {
|
|
247
|
+
if (typeof v === 'number' && Number.isFinite(v))
|
|
248
|
+
return v;
|
|
249
|
+
if (typeof v === 'string') {
|
|
250
|
+
const n = parseFloat(v);
|
|
251
|
+
if (Number.isFinite(n))
|
|
252
|
+
return v.trim().endsWith('%') ? n / 100 : n;
|
|
253
|
+
}
|
|
254
|
+
return fallback;
|
|
255
|
+
}
|
|
256
|
+
function numberOrZero(v) {
|
|
257
|
+
if (typeof v === 'number' && Number.isFinite(v))
|
|
258
|
+
return v;
|
|
259
|
+
if (typeof v === 'string') {
|
|
260
|
+
const n = parseFloat(v);
|
|
261
|
+
return Number.isFinite(n) ? n : 0;
|
|
262
|
+
}
|
|
263
|
+
return 0;
|
|
264
|
+
}
|
|
265
|
+
function parseDuration(v, fallback) {
|
|
266
|
+
if (v === 'auto' || v === 'end' || v == null)
|
|
267
|
+
return fallback;
|
|
268
|
+
if (typeof v === 'number' && Number.isFinite(v))
|
|
269
|
+
return v;
|
|
270
|
+
if (typeof v === 'string') {
|
|
271
|
+
const n = parseFloat(v);
|
|
272
|
+
return Number.isFinite(n) ? n : fallback;
|
|
273
|
+
}
|
|
274
|
+
return fallback;
|
|
275
|
+
}
|
|
276
|
+
//# sourceMappingURL=resolve.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":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AAC;IAC9D,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC;QAAE,OAAO,CAAC,CAAC;IAC1D,IAAI,OAAO,CAAC,KAAK,QAAQ,EAAE,CAAC;QAC1B,MAAM,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC;QACxB,OAAO,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC;IAC3C,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Source } from '@clipkit/protocol';
|
|
2
|
+
import type { RenderContext } from './render-context.js';
|
|
3
|
+
/**
|
|
4
|
+
* Render one frame of the source at the given time.
|
|
5
|
+
* Caller is responsible for backend.beginFrame() / endFrame() — this lets
|
|
6
|
+
* the runtime use the same scene-render code for preview and export
|
|
7
|
+
* without worrying about who controls the frame lifecycle.
|
|
8
|
+
*/
|
|
9
|
+
export declare function renderSourceFrame(source: Source, ctx: RenderContext): void;
|
|
10
|
+
//# sourceMappingURL=scene.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scene.d.ts","sourceRoot":"","sources":["../../src/compositor/scene.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAmF,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAoBjI,OAAO,KAAK,EAAmB,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAE1E;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,aAAa,GAAG,IAAI,CA2B1E"}
|