@aelionsdk/render-ir 1.0.0-rc.1 → 1.2.0-rc.1
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 +27 -4
- package/dist/evaluate.d.ts.map +1 -1
- package/dist/evaluate.js +55 -0
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -1,7 +1,30 @@
|
|
|
1
|
-
#
|
|
1
|
+
# `@aelionsdk/render-ir`
|
|
2
2
|
|
|
3
|
-
Incremental
|
|
3
|
+
Incremental Project-to-Render-IR compilation and deterministic timeline
|
|
4
|
+
evaluation for AelionSDK.
|
|
4
5
|
|
|
5
|
-
Install
|
|
6
|
+
## Install
|
|
6
7
|
|
|
7
|
-
|
|
8
|
+
```bash
|
|
9
|
+
npm install @aelionsdk/render-ir@next
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
`next` currently resolves to `1.2.0-rc.1`. Product applications should use
|
|
13
|
+
`@aelionsdk/sdk`; direct use is for custom renderers, exporters and engine
|
|
14
|
+
instrumentation.
|
|
15
|
+
|
|
16
|
+
## Public surface
|
|
17
|
+
|
|
18
|
+
- cold and incremental Project compilation;
|
|
19
|
+
- visual and audio timeline evaluation;
|
|
20
|
+
- captions, text layout and time maps;
|
|
21
|
+
- color and bit-depth contracts;
|
|
22
|
+
- compile statistics and Render IR types.
|
|
23
|
+
|
|
24
|
+
Preview and export should consume the same validated Render IR rather than
|
|
25
|
+
maintaining separate timeline semantics. Unsupported color or time-map
|
|
26
|
+
combinations fail closed.
|
|
27
|
+
|
|
28
|
+
See the [render consistency guide](https://foyonaczy.github.io/AelionSDK/concepts/render-consistency/)
|
|
29
|
+
and [API reference](https://foyonaczy.github.io/AelionSDK/api/aelionsdk/render-ir/overview/).
|
|
30
|
+
Licensed under MIT.
|
package/dist/evaluate.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"evaluate.d.ts","sourceRoot":"","sources":["../src/evaluate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAChB,iBAAiB,EAGjB,YAAY,EAOZ,kBAAkB,EAClB,yBAAyB,EACzB,QAAQ,EACT,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"evaluate.d.ts","sourceRoot":"","sources":["../src/evaluate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAChB,iBAAiB,EAGjB,YAAY,EAOZ,kBAAkB,EAClB,yBAAyB,EACzB,QAAQ,EACT,MAAM,YAAY,CAAC;AA6KpB,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,OAAO,iBAAiB,EAAE,SAAS,EAC1C,cAAc,EAAE,MAAM,EACtB,YAAY,SAAI,uCAiDjB;AAED,wBAAgB,wBAAwB,CACtC,KAAK,EAAE,OAAO,iBAAiB,EAAE,SAAS,GAAG,SAAS,EACtD,cAAc,EAAE,MAAM,EACtB,YAAY,EAAE,MAAM,EACpB,QAAQ,EAAE,MAAM,GACf,MAAM,CAIR;AAED,wBAAgB,wBAAwB,CACtC,QAAQ,EAAE,kBAAkB,EAC5B,cAAc,EAAE,MAAM,EACtB,YAAY,SAAI,GACf,yBAAyB,CAY3B;AAsBD,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAE3F;AAqDD,wBAAgB,kBAAkB,CAChC,EAAE,EAAE,QAAQ,EACZ,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,MAAM,GACjB,gBAAgB,CA8DlB;AAED,wBAAgB,mBAAmB,CAAC,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,GAAG,iBAAiB,CA0DnF"}
|
package/dist/evaluate.js
CHANGED
|
@@ -73,6 +73,57 @@ function easingProgress(progress, from) {
|
|
|
73
73
|
}
|
|
74
74
|
return from.interpolation === 'cubic-bezier' ? cubicBezierProgress(progress, easing) : progress;
|
|
75
75
|
}
|
|
76
|
+
function bezierComponent(progress, from, handleOut, handleIn, to) {
|
|
77
|
+
const inverse = 1 - progress;
|
|
78
|
+
return (inverse * inverse * inverse * from +
|
|
79
|
+
3 * inverse * inverse * progress * handleOut +
|
|
80
|
+
3 * inverse * progress * progress * handleIn +
|
|
81
|
+
progress * progress * progress * to);
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Interpolate a value between two keyframes using explicit Bézier handles
|
|
85
|
+
* (`handleOut` on the from keyframe, `handleIn` on the to keyframe). Handles
|
|
86
|
+
* are value-space tangents: for a scalar value the tangent is the `y`
|
|
87
|
+
* component (added to the value), and for a `{x,y}` vector both components
|
|
88
|
+
* are added as the control point offset. Falls back to plain progress-based
|
|
89
|
+
* interpolation when no handle is present on the from keyframe.
|
|
90
|
+
*/
|
|
91
|
+
function interpolateWithHandles(fromValue, toValue, progress, fromKeyframe, toKeyframe) {
|
|
92
|
+
const handleOut = objectProperty(Reflect.get(fromKeyframe, 'handleOut'));
|
|
93
|
+
if (Object.keys(handleOut).length === 0)
|
|
94
|
+
return interpolateJson(fromValue, toValue, progress);
|
|
95
|
+
const handleIn = objectProperty(Reflect.get(toKeyframe, 'handleIn'));
|
|
96
|
+
if (typeof fromValue === 'number' && typeof toValue === 'number') {
|
|
97
|
+
const outTangent = numberProperty(handleOut.y, 0);
|
|
98
|
+
const inTangent = numberProperty(handleIn.y, 0);
|
|
99
|
+
return bezierComponent(progress, fromValue, fromValue + outTangent, toValue + inTangent, toValue);
|
|
100
|
+
}
|
|
101
|
+
if (fromValue !== null &&
|
|
102
|
+
toValue !== null &&
|
|
103
|
+
typeof fromValue === 'object' &&
|
|
104
|
+
typeof toValue === 'object' &&
|
|
105
|
+
!Array.isArray(fromValue) &&
|
|
106
|
+
!Array.isArray(toValue)) {
|
|
107
|
+
const outX = numberProperty(handleOut.x, 0);
|
|
108
|
+
const outY = numberProperty(handleOut.y, 0);
|
|
109
|
+
const inX = numberProperty(handleIn.x, outX);
|
|
110
|
+
const inY = numberProperty(handleIn.y, outY);
|
|
111
|
+
const scalar = (key) => {
|
|
112
|
+
const fromScalar = fromValue[key];
|
|
113
|
+
const toScalar = toValue[key];
|
|
114
|
+
if (typeof fromScalar !== 'number' || typeof toScalar !== 'number')
|
|
115
|
+
return undefined;
|
|
116
|
+
const out = key === 'x' ? outX : outY;
|
|
117
|
+
const inn = key === 'x' ? inX : inY;
|
|
118
|
+
return bezierComponent(progress, fromScalar, fromScalar + out, toScalar + inn, toScalar);
|
|
119
|
+
};
|
|
120
|
+
const x = scalar('x');
|
|
121
|
+
const y = scalar('y');
|
|
122
|
+
if (x !== undefined && y !== undefined)
|
|
123
|
+
return { x, y };
|
|
124
|
+
}
|
|
125
|
+
return interpolateJson(fromValue, toValue, progress);
|
|
126
|
+
}
|
|
76
127
|
export function evaluateAnimatedValue(value, sequenceTimeUs, ownerStartUs = 0) {
|
|
77
128
|
if (!isAnimation(value))
|
|
78
129
|
return value;
|
|
@@ -115,6 +166,10 @@ export function evaluateAnimatedValue(value, sequenceTimeUs, ownerStartUs = 0) {
|
|
|
115
166
|
return from.value;
|
|
116
167
|
}
|
|
117
168
|
let progress = (timeUs - from.timeUs) / (to.timeUs - from.timeUs);
|
|
169
|
+
const hasHandleOut = Reflect.get(from, 'handleOut') !== undefined;
|
|
170
|
+
if (hasHandleOut) {
|
|
171
|
+
return interpolateWithHandles(from.value, to.value, progress, from, to);
|
|
172
|
+
}
|
|
118
173
|
progress = easingProgress(progress, from);
|
|
119
174
|
return interpolateJson(from.value, to.value, progress);
|
|
120
175
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aelionsdk/render-ir",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0-rc.1",
|
|
4
4
|
"description": "Incremental render intermediate representation compiler for AelionSDK",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -27,16 +27,16 @@
|
|
|
27
27
|
"!dist/.tsbuildinfo"
|
|
28
28
|
],
|
|
29
29
|
"engines": {
|
|
30
|
-
"node": ">=
|
|
30
|
+
"node": ">=24 <25"
|
|
31
31
|
},
|
|
32
32
|
"publishConfig": {
|
|
33
33
|
"access": "public",
|
|
34
34
|
"provenance": true
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@aelionsdk/core": "1.
|
|
38
|
-
"@aelionsdk/material-compiler": "1.
|
|
39
|
-
"@aelionsdk/project-schema": "1.
|
|
37
|
+
"@aelionsdk/core": "1.2.0-rc.1",
|
|
38
|
+
"@aelionsdk/material-compiler": "1.2.0-rc.1",
|
|
39
|
+
"@aelionsdk/project-schema": "1.2.0-rc.1"
|
|
40
40
|
},
|
|
41
41
|
"scripts": {
|
|
42
42
|
"build": "tsc -b",
|